in reply to Re^2: JSON character encoding
in thread JSON character encoding

This statement is true – but implied.   Therefore, let me clarify my previous statement.

The character-encoding of the transferred data must be agreed-upon by both the sending and the receiving parties.   The specification says that the data can be UTF-encoded, which is to say that the JSON data-format has no encoding scheme of its own.   Furthermore, the character-encoding (or lack thereof) of the transferred data has no bearing on how the data is packaged into syntactically valid, parseable, “JSON.”   The structural format does not contain nor rely upon Unicode characters.   Rather, it is agnostic to them.   It is equally capable of “sending the necessary bytes to you, correctly,” no matter how you consider the bytes that you received “to have been ‘encoded,’ if at all.”

Thank you for the clarification, “Mom.”   That was, indeed, an important point.

Replies are listed 'Best First'.
Re^4: JSON character encoding
by Anonymous Monk on May 31, 2017 at 07:51 UTC
    What are you talking about? If the JSON standard dictates a set of encodings and you violate that standard, the file you produce is no longer JSON ... by definition. If it's not UTF, it's not JSON and arguments to the contrary are a waste of time.

      The text of the JSON must be encoded as UTF-8, UTF-16 or UTF-32.

      The data represented by the JSON text, however, may be further encoded in other ways.

      For example, in JSON, a sequence of bytes could be represented as an array of numbers, a string of hexadecimal digits, or something else. What those bytes mean to the sending and receiving applications must be agreed upon outside of JSON.

      That said, the JSON specification requires that string values in JSON must be in Unicode, possibly using escape sequences. (Which are \u followed by 4 hexadecimal digits. for example, "\u005C" is a \)