Closed allemangD closed 3 years ago
json.loads
can parse single-quoted JSON
Today I learned this is not true! So the change does break all old files.
I think the best way forward is to attempt to parse the JSON without the replacement, and if that fails with JSONDecodeError
then attempt to parse with the replacement. If that fails then it would contain something like 'landmarkLabel': 'UR1'',
which can't be recovered automatically.
I'll open a new PR to implement the fix.
Q3DCLogic.encodeJSON
,Q3DCLogic.decodeJSON
both replaced"
by'
... it's been this way since 72746506 (2015), but I don't see any explanation of why it was done that way. See https://github.com/DCBIA-OrthoLab/Q3DCExtension/blob/727465067c94719831c6dcc7cc2ef410c3c7160e/Q3DC/Q3DC.py#L1480-L1487This change shouldn't break any compatibility with existing files.json.loads
can parse single-quoted JSON, and if a file were successfully created with the replacement then it should be valid json, just single-quoted. So then it should be parsable after this commit.Resolves #75.