vendredi 5 avril 2019

Standard way of Serializing utf-8 characters in a JSON String

What's the standard way of serializing a utf-8 string in JSON? Should it be with u escaped sequence or should it be the hex code.

I want to serialize some sensor readings with units in a JSON Format.

For example I have temperature readings with units °C. Should it be serialized as

{
 "units": "\u00b0"
}
´´´
or should it be something like 
´´´
{
 "units":"c2b0"
}

Or could both of these supported by the standard.

Aucun commentaire:

Enregistrer un commentaire