Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

> does it always use UTF8 or does it break the standard?

It always uses UTF8, or it is invalid JSON and MUST NOT be parsed. For the same argument against XML, you could argue whether it actually honours the encoding field (i've found many cases where things lie in the encoding field, and still parse fine by XML parsers)

> Which version of the JSON Schema does it use?

Quite literally the only one I have ever seen in use, ever, is JSON Schema[0].

> Is it using a schema at all?

Most often, no.

> What happens when "$ref" appears in the content body?

Nothing? JSON doesn't have lookups. There is no way to do lookups in JSON. If you do otherwise, you do not have JSON anymore.

> How should I deal with duplicate keys?

This is an actual, real issue with JSON.

XML is a terrible format. It's filled to the brim with footgun features like entity expansion (only ever used to DOS servers), no data types (everything is a string, your parser just needs to know better), no meaningful reason to have both attributes and content, ambiguity between an array of one element and an element, etc. etc. etc.

[0]: https://json-schema.org/



Maybe I'm misunderstanding, but JSON as defined in RFC 7159 doesn't require UTF-8.


8.1. Character Encoding

   JSON text exchanged between systems that are not part of a closed
   ecosystem MUST be encoded using UTF-8 [RFC3629].
JSONs definition was improved in RFC8259 (2017) to mandate UTF-8.


Missed that. Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: