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

JSON keys with dots (periods) #483

Closed
neurolabusc opened this issue Feb 24, 2021 · 3 comments
Closed

JSON keys with dots (periods) #483

neurolabusc opened this issue Feb 24, 2021 · 3 comments

Comments

@neurolabusc
Copy link
Collaborator

The BIDS standard stores values in JSON key-value pairs. Users are allowed to define their own filenames (keys) as long as they are not defined. At the request of the Oxford BASIL team, recent versions of dcm2niix now copy a large number of fields from the Siemens CSA header to the BIDS sidecar. I copied the filenames verbatim. However, it has been brought to my attention that a few of these include a dot in the key name, and that this confounds usage with tools like Matlab and JavaScript (which requires square bracket syntax to handle these). For example:

	"sWipMemBlock.AdFree3": -25,
	"sWipMemBlock.AdFree4": 25,
	"sWipMemBlock.AdFree5": 25,
	"sWipMemBlock.AdFree6": 25,
	"sWipMemBlock.AdFree7": -25,
	"sWipMemBlock.AdFree8": -25,
	"sWipMemBlock.AdFree9": 25,
	"sWipMemBlock.AdFree10": -25,

I would like to suggest that we simply remove the dot from these keys, e.g. sWipMemBlockAdFree7. However, I would like to make sure that no one feels strongly about this change.

I know that @satra has raised concerns about sanitizing information, and in general I try to avoid changes that might impact other code. @effigies and @mcraig-ibme might have thoughts on this.

@effigies
Copy link

The other thing I could see is promoting to an object and getting

    "sWipMemBlock": {"AdFree3": -25, ...}

Not sure if that would collapse onto some other notation that produces objects...

@pvelasco
Copy link

For what is worth, AdFree (in the Siemens programming environment) is an array of doubles that the programmer can use for whatever they need. So maybe it would make sense to just make it a list (or a tuple):

	"sWipMemBlock.AdFree4": [-25, 25, 25, 25, -25, -25,...]

@neurolabusc
Copy link
Collaborator Author

Closing this. The upcoming version will remove the dots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants