Rank: 1628 based on 90 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 90 21
  • 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
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

15 Jan 2012 (another) JSON Parser Parses JSON strings into structures and cell arrays. Author: François Glineur Fang, Qianqian

FYI, an optimized JSON parser, JSONlab, based on this work is available at

http://www.mathworks.com/matlabcentral/fileexchange/33381

It is 10x to 100x faster. A JSON encoder is also provided in JSONlab.

Contact us