From RFC4627:
Numeric values that cannot be represented as sequences of digits (such
as Infinity and NaN) are not permitted.
NaN is invalid, so we already return null.
JSON supports UTF-16, however the serializer is 8-bit clean. Instead of
returning a QString only to turn it back into a QByteArray, return a
QByteArray on serialization.