Skip to content

JSON bug TestDataSet & xASL_io_ReadJson #1419

@HenkMutsaerts

Description

@HenkMutsaerts

Description

The dataPar.json of the TestDataSet is invalid (1 comma too much); perhaps this was fixed automatically in the previous json reader. Also, the error is not clear enough.

ERROR:
Error using jsondecode
JSON syntax error at line 5, column 2 (character 92): expected quoted name but found '}'.

Error in xASL_io_ReadJson (line 46)
json = jsondecode(txt);
  1. So "syntax error" could be too generic/unknown word for some layman users.
  2. Even I don't know what "quoted name" means, please rewrite to more layman language
  3. The path of the invalid JSON is not shown

Tasks

  • Fix TestDataSet dataPar.json
  • xASL_io_ReadJson: add path invalid JSON & a hint, something like:
"ERROR: /Users/ExploreASL/derivatives/dataPar.json is an invalid JSON". 
HINT: test your JSON file content at https://jsonlint.com/
  • Do we need to change xASL_ut_function_xASL_io_ReadJson.m?

How to test

Add an illegal comma in 'ExploreASL/External/TestDataSet/dataPar.json' and run

xASL_io_ReadJson('ExploreASL/External/TestDataSet/dataPar.json');

Release notes

User-friendly warnings when JSON is invalid. Report together with #1311

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions