Bug #769
closeddcm2json produces invalid JSON for broken DS or IS values
100%
Description
dcm2json produces invalid JSON if encountering invalid DS or IS values. The issue showed up in a dataset where a DS-value (RescaleIntercept) contained the value "US". This results in the output "vr":"DS","Value":[US]. Obviously, US is not a valid JSON Number, i.e. the resulting JSON output will be rejected by all(?) JSON parsers.
dcm2json is not responsible for invalid values in the output. However, whenever easily possible, the resulting JSON output should always have a valid syntax.
I'd propose to have a check in IS and DS writeJSON() routines which stop with an error if such an invalid value is encountered.
Updated by Jan Schlamelcher about 8 years ago
- Target version changed from 3.6.2 to 3.6.3
Updated by Jan Schlamelcher over 7 years ago
- Target version changed from 3.6.3 to 3.6.4
Updated by Jörg Riesmeier over 7 years ago
- Target version changed from 3.6.4 to 3.6.6
Updated by Jörg Riesmeier almost 7 years ago
See also proposed CP "cp_ns05 change JSON value type mapping IS and DS.docx" in the private WG-06 folder.
Updated by Jörg Riesmeier almost 7 years ago
The above-mentioned CP now has a number: CP-1861 (Consistency between DICOM VR definition of DS & IS, and JSON Value Representation)
Updated by Jörg Riesmeier almost 6 years ago
Also see this posting on StackOverflow: https://stackoverflow.com/questions/58035018/dcmtk-dcm2json-produces-invalid-json-for-broken-ds-or-is-values
Updated by Jörg Riesmeier over 5 years ago
CP-1861 has been approved as Final Text: ftp://medical.nema.org/medical/dicom/final/cp1861_ft_changeJSONvaluetypemappingISandDS.pdf
Updated by Jörg Riesmeier over 5 years ago
- Related to Conformance #881: Check our implementation of dcm2json against DICOM Supplement 183 added
Updated by Marco Eichelberg about 5 years ago
- Status changed from New to Closed
- Assignee set to Marco Eichelberg
- % Done changed from 0 to 100
The implementation in DCMTK now uses the encoding introduced with DICOM CP 1861 for these cases: if any value of an IS or DS element is illegal, then all values of that element are printed as Json strings and not as numbers.
Closed by commit #10713dba6.