gknauth
2022-3-2 14:03:27

JSON has its uses. When you want to be super flexible, improvisational, or just loosey-goosey, JSON shines. When you want to adhere to a spec, XML is more trustworthy.


massung
2022-3-2 15:09:42

What makes you say that? JSON has schemas (admittedly not part of the original spec, but they do exist and are used). Also, JSON at least supports typed data. When I read a JSON file I know the types of:

{"foo": true, "bar": 10, "baz": "hello"} In XML that information is lost unless you provide it as additional information within the XML itself - like a schema. This provided added work for whoever is reading the data to either “just know”, know there’s a schema (like JSON schemas), or attempt parsing of every attribute/inner text.

Both allow for missing or incomplete data. Neither allows for malformed data (e.g. HTML).


tomdtron
2022-3-2 16:12:53

@tomdtron has joined the channel