Rank: 1647 based on 72 downloads (last 30 days) and 1 file submitted
photo

François Glineur

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by François
Updated   File Tags Downloads
(last 30 days)
Comments Rating
11 Jan 2011 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur json, parser, javascript, cells, cell arrays, data import 72 22
  • 4.85714
4.9 | 7 ratings
Comments and Ratings by François View all
Updated File Comments Rating
01 Jun 2013 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur

Hi Karamos,
This code is designed to parse JSON strings ; in your example it is not clear where the JSON string to be parsed is supposed to come from. Also note this code should be called with a string, so "cellstr" is not necessary.

11 Jan 2011 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur

Dear Benjamin: you are right, the function returns a cell array only if the topmost entity in the JSON string is an array ; if it is instead an object, the function returns a structure. I have updated the description to reflect that.

21 Jul 2009 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur

Rob, the problem is caused by field "526A", which MATLAB cannot accept because field names in MATLAB must start with a letter. I will update the parser to convert invalid field names into acceptable ones.

21 Jul 2009 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur

Rob, have you checked that the argument you pass to parse_json is a string ? The easiest way to convert the contents of a file into a string is to use the function fileread, as in this example :

s = fileread('file.json');
res = parse_json(s);

23 Mar 2009 JSON Parser Parses JSON strings into structures and cells Author: Joel Feenstra

An alternative parser with faster handling of strings is available at http://www.mathworks.com/matlabcentral/fileexchange/23393
(another JSON Parser). For example, running the example above

companies=parse_json(urlread('http://api.crunchbase.com/v/1/companies.js'));

with it now takes less than 30 seconds.

Comments and Ratings on François' Files View all
Updated File Comment by Comments Rating
13 May 2014 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur jason

hello Francois! I have used your program to parse my json file and it succeeded! thank your for your efforts!

but when I try to use parse_json to parse a much larger json file which is 3.38G errors occurred. I can't understand the errors, can you help me? follow is the error message:

Error using parse_json/error_pos (line 191)
Expected , at position 285210628 : ... " : "闂佃10璺?,
"<error>BaiduLongitute" : 121 ...

Error in parse_json/parse_char (line 68)
error_pos(sprintf('Expected %c at position %%d', c));

Error in parse_json/parse_object (line 43)
parse_char(',');

Error in parse_json/parse_value (line 157)
val = parse_object;

Error in parse_json/parse_array (line 54)
val = parse_value;

Error in parse_json (line 22)
data = parse_array;

Error in ProgrameForBus_position (line 2)
data=parse_json(string)

and I firstly use fileread function to transfer json to string, the string had been successfully obtained.

04 Feb 2014 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur ciao

Hi! I parsed this url:
url = 'http://api.wunderground.com/api/ea9003517a31d389/hourly10day/settings/q/IT/Venezia.json';
contents = urlread(url);
data = parse_json(contents);

How can I transform the structure data in arrays with the ourly temperature/humidity ext data?

Thanks in advance
davide

30 Jun 2013 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur Oscar

This worked great. (better than the original parser by Feenstra)

01 Jun 2013 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur Glineur, François

Hi Karamos,
This code is designed to parse JSON strings ; in your example it is not clear where the JSON string to be parsed is supposed to come from. Also note this code should be called with a string, so "cellstr" is not necessary.

29 May 2013 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur Karamos

Could you please give me an indication how to convert this string into cell:

fullURL = ['http://www.fxstreet.com/'];
matlab_results = parse_json(cellstr(urlread(fullURL)))

I have the following error

??? SWITCH expression must be a scalar or string constant.

Error in ==> parse_json_V1 at 18
switch(next_char)

thanks

Contact us