Fix writing of NULLs in JSON data message - SDMXRI-1566 - NSI WS 8.1.3
In case the observation value is NULL in database, the JSON writers (both flat and series) write empty string ""
instead of null even if the local representation of the primary measure is not a string-type.
The empty string as observation value in JSON message is created by the GetObservationValueRawJsonString method of AbstractJsonV10DataWriter class in SdmxSource library.
The import process stores the observation value as NULL in database and the SQL query of the related mapping set also returns NULL for these observation value. However, when it reaches the JSON writer the observation becomes empty string already, so instead of null
, the empty string ""
is written into the JSON message. Interestingly, this logic has been there in this method for long, but it seems that the default data retriever of NSI WS behaves differently compared to our obsolete custom data plugin and does this transformation of null to empty string at some stage of the data retrieval in the observation object.
Sample can be found in this conversation of the related ticket: dotstatsuite-data-explorer#474 (comment 495385696)
Tasks:
- Crate a JIRA ticket at ESTAT: https://citnet.tech.ec.europa.eu/CITnet/jira/browse/SDMXRI-1566
- Change the GetObservationValueRawJsonString method and write
null
instead of empty string when the primary measure is not string-typed. - Identify and understand why the
null
value of an observation is changed to empty string and if it is a result of a bug, then correct it.
The following files can be used to reproduce the issue: