News for hackers. Stuff that matters.
Re:JSON vs. XML with Douglas Crockford by dwaite on Thursday April 06, 2023 @10:27PM (#35477285)
Yep:

- If you are describing hierarchal data, JSON is great

- If you are describing text with markup, especially extensible markup, for machine generation and consumption, XML is great.

- If you are describing a graph, neither have broadly accepted standards so you are kinda on your own.

Depending on your requirements, a recipe collection might be better in XML or in a flavor of markdown. A comprehensive data schema and software support for recipes could be challenging/limiting, compared to marked-up text.

Re:JSON vs. XML with Douglas Crockford by creatonez on Friday April 07, 2023 @04:55AM (#35479651)
> If you are describing a graph, neither have broadly accepted standards so you are kinda on your own

Relational databases can describe most graphs, but they rarely ever have a great text format.

Re:JSON vs. XML with Douglas Crockford by goto11 on Friday April 07, 2023 @07:03AM (#35480336)
And CSV for tabular data!
Re:JSON vs. XML with Douglas Crockford by stickfigure on Friday April 07, 2023 @09:31AM (#35481390)
If only it was more standardized :-(
Re:JSON vs. XML with Douglas Crockford by stickfigure on Friday April 07, 2023 @09:27AM (#35481354)
Markdown (like HTML) offers formatting structure, not semantic structure. Maybe you want to query for recipes that can be made in under an hour, or that contain orange as an ingredient (as opposed to merely a serving suggestion in an orange bowl). A proper XML (or even JSON or YAML) structure would enable this, Markdown does not.

You can pretty easily translate XML to Markdown using XSLT, though.

I don't think hierarchal structure is the differentiator; recipes and web pages are hierarchical and they'd still be hell in JSON. XML handles hierarchy just fine. I think the differentiator is whether your content is a document, that is, composed significantly of multiline text. Multiline text in a JSON file tends to be human-hostile, but we're all comfortable editing eg html.