Closed iSnow closed 10 months ago
Basically, the described workaround is what Table Schema officially requires to do - https://datapackage.org/specifications/table-schema/#physical-and-logical-representation
If a number field cell is represented by a string it needs to be processed, including substituting special string values
. So that will be a correct way to do so as mentioned:
[
{
"id": 1,
"amount": 100
},
{
"id": 2,
"amount": "NaN"
}
]
While the TableSchema spec seems mostly written for CSV tabular data and JSON arrays of JSON objects as an encoding added later, the specification for a
number
field states:In contrast, the ECMA JSON specification states:
and the RFC 7159 also contains this statement.
Strictly speaking, this is unsalvageable. As a workaround, we could define that the corresponding string literals can be used, so the following CSV
would be represented in JSON as