> undefined, Function, and Symbol values are not valid JSON values
that's the point.
The official JSON serializer from every broswer vendor and every Node installation produce invalid JSON.
Which for the JavaScriptObjectNotation is kinda hilarious.
> Expecting `jq` to somehow understand that its input came from Javascript's `JSON.stringify()`
I would expect `JSON.stringify` to give an error if trying to serialize something that naturally does not map to JSON, like many other libraries do.
You have to provide a manual override for those situations.
But JavaScript and ECMA (`JSON.stringify` is defined in the standard) decided that no, they can ignore the specs for some reason.
Problem is they can't fix it now, because too many applications rely on those wrong assumptions.
Here it is the reason why you can find <flag>true</flag> and <flag>1</flag>
Difference being XML was born to standardize the document format, JSON aspired to be a data format but failed miserably at it, even at the most basic level, like saying an int from a float. The spec is simply too vague and ambiguous to give some guarantee of interoperability, beyond numbers and strings.
Maybe we should all switch to MessagePack