Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing array #31

Closed
toloko opened this issue Feb 9, 2017 · 3 comments
Closed

Error parsing array #31

toloko opened this issue Feb 9, 2017 · 3 comments
Labels

Comments

@toloko
Copy link

toloko commented Feb 9, 2017

In a JSON file, when using array notation (without quotes), only the first value is parsed. When trying to parse:

{ "value" : [3:10] }

value will evaluate to 3. This problem is related to 'sscanf' function in line 179 from loadjson.m:
[obj, count, errmsg, nextidx]=sscanf(astr,'%f,',[1,inf]);

@fangq fangq added the invalid label Feb 9, 2017
@fangq
Copy link
Member

fangq commented Feb 9, 2017

@toloko, "[3:10]" is not a valid JSON syntax, you can test it on http://jsonlint.com/
according to http://json.org, JSON array only supports comma-separated values.

@fangq fangq closed this as completed Feb 9, 2017
@toloko
Copy link
Author

toloko commented Feb 9, 2017

Thanks for the comment and for your work.

Should it not 'loadjson' throw an error in such a case?

Thanks

@fangq fangq reopened this Feb 9, 2017
@fangq
Copy link
Member

fangq commented May 31, 2017

interesting, the same line now evaluates as the anticipated result in matlab 2017a, but jsonlab should have thrown an error.

>> dd=loadjson('{ "value" : [3:10] }')

dd = 

  struct with fields:

    value: {[3 4 5 6 7 8 9 10]}

@fangq fangq closed this as completed in f16cc57 Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants