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

[BUG] jsondecode failure #392

Open
Remi-Gau opened this issue Jun 16, 2022 · 5 comments
Open

[BUG] jsondecode failure #392

Remi-Gau opened this issue Jun 16, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@Remi-Gau
Copy link
Collaborator

very edge case

from https://openneuro.org/datasets/ds003216/versions/2.1.5/

json_file: ds003216/sub-02/ses-02/func/sub-02_ses-02_task-tapping_run-05_cbv.json

Many warning and eventually this error

> In matlab.internal.json.makeStructure (line 4
[failing_json.txt](https://github.com/bids-standard/bids-matlab/files/8918450/failing_json.txt)
9)
  In bids.util.jsondecode (line 37) 
Error using cell2struct
Duplicate field name "CsaSeries_MrPhoenixProtocol_asCoilSelectMeas_0__aFFT_SCALE_10__"

Error in matlab.internal.json.makeStructure (line 49)
data = cell2struct(values, names, 1);

Error in bids.util.jsondecode (line 37)
    value = jsondecode(fileread(file));

File content: added as txt

@Remi-Gau
Copy link
Collaborator Author

Check if JSONio fails on this too.

@gllmflndn
Copy link
Collaborator

That works for me with jsondecode from MATLAB R2021a and Octave and with JSONio. Which version are you using?

Also, I agree this is a valid JSON file but isn't it a bit odd for a fieldname?
"CsaSeries.MrPhoenixProtocol.asCoilSelectMeas[0].aFFT_SCALE[10].flFactor": 0.0419083

@Remi-Gau
Copy link
Collaborator Author

Which version are you using?

Matlab 2017a

Also, I agree this is a valid JSON file but isn't it a bit odd for a fieldname?
"CsaSeries.MrPhoenixProtocol.asCoilSelectMeas[0].aFFT_SCALE[10].flFactor": 0.0419083

I don't decide how DICOM headers happen. :-p

@gllmflndn
Copy link
Collaborator

OK, I can confirm the issue: jsondecode was introduced in R2016b and it crashes with this JSON file in R2016b and R2017a. It's OK from R2017b onwards.

@Remi-Gau
Copy link
Collaborator Author

Thanks a bunch for cross checking this.

Will add it in the doc.

@Remi-Gau Remi-Gau added the bug Something isn't working label Jun 25, 2022
@Remi-Gau Remi-Gau moved this to Wish list in BIDS-matlab Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Wish list
Development

No branches or pull requests

2 participants