Live data from Hacker News

JSON vs. XML

corecursive.com

71–80 of 252 posts

Re: JSON vs. XML

#71
post #26

I have huge respect for Doug Crockford, and I never imagined I would disagree with him. However I think by now we've seen that a lot of that "unnecessary" XML complexity was not, in fact, entirely unnecessary. These days we use JSON for everything, but now we've got JSON Schema, Swagger/OpenAPI, Zod, etc etc. It's not really simpler and there's a lot of manual work - we might as well be using XML, XSD & SOAP/WSDL.

JSON is great, but I surely wish it supported comments. That's the nature of its failings: too minimal.

You can use JSONC, which is JOSN with C style comments.

Re: JSON vs. XML

#72
post #9

Earlier quoted context omitted.

I remember a meeting where a consultant from an MCP excitedly told our mutual client that the XP in the upcoming version of Windows stood for 'XML Protocol.' More innocent times.

Scala had XML literals as part of the language! Apparently Philip Wadler was the person who told them needed it, because the future was XML. ( Walder is big Haskell/PL person)

VB.NET still has them. I remember doing a project with an XML database (ugh) back in college when the version with the literals was released. I was ecstatic.

Re: JSON vs. XML

#73
I really hope that one day CUELANG will catch on to generate and validate JSON.

The current state of JSON generation/validation is simpler than the XML ecosystem, but a bit hackish.

We can have a much better stack.

Re: JSON vs. XML

#74
post #26

Earlier quoted context omitted.

JSON is great, but I surely wish it supported comments. That's the nature of its failings: too minimal.

Comments are simple to parse, but preserving them on the dump is complex. I guess they were sacrificed for the simplicity.

That’s a good point. It would be hard to read the JSON, modify it and then write back with comments.

But you still should have the option to at least ignore them while reading. That would make JSON config files so much better to work with.

Re: JSON vs. XML

#75
post #54
post #26

Earlier quoted context omitted.

JSON is great, but I surely wish it supported comments. That's the nature of its failings: too minimal.

This always bothered me. A coworker once suggested using fields ending in 'notes' to put in comments but I never really warmed up to that.

I have heard that too but it’s just a terrible idea.

Re: JSON vs. XML

#76
post #55

Earlier quoted context omitted.

That was the cause of the XML problems - everything was generated. Me? Schemas are a requirement in areas where you need to integrate over different technology / with different implementations. JSON Schema is in those contexts a bit of a kids toy compared to what XML can do.

Adding to the problems of generated schemas, Microsoft and Sun both had different views on how they should be generated. I bought into the promise of "build a wsdl" and you can get clients from .NET and Java. I lost all of that buy in. Hard. I don't know that I can lay the blame on either one of them directly, mind. But the industry definitely suffered from the bad faith cooperation of those companies.

Microsoft, Sun, IBM, HP, Oracle et al explicitly made WDSL and related technologies not interoperate... and that is where JSON + universe has been a delight.

Re: JSON vs. XML

#77

I have huge respect for Doug Crockford, and I never imagined I would disagree with him. However I think by now we've seen that a lot of that "unnecessary" XML complexity was not, in fact, entirely unnecessary. These days we use JSON for everything, but now we've got JSON Schema, Swagger/OpenAPI, Zod, etc etc. It's not really simpler and there's a lot of manual work - we might as well be using XML, XSD & SOAP/WSDL.

With XML, the complexity is the baseline, and it only goes up from there. With JSON, the complexity is just an option, the baseline is pretty simple. Also, good XML-tools are rare or expensive.

Also this may just be the time in which I got into programming showing, but it seems like JSON encoding/decoding has been built into more languages than support for XML ever was. That's one less required dependency and thing to have to think about in many cases, like in Swift projects all I have to do is make sure my model structs/classes conform to Codable and I'm ready to hit endpoints.

Re: JSON vs. XML

#78
post #9

Earlier quoted context omitted.

I remember a meeting where a consultant from an MCP excitedly told our mutual client that the XP in the upcoming version of Windows stood for 'XML Protocol.' More innocent times.

I had a power strip which had "works with windows 95" on the packaging box.

This is just an example of how marketing knows nothing about the products they are marketing, or are just flat out snake oil sales. Like packaging for bacon exclaiming "gluten free"

Re: JSON vs. XML

#79
post #6

Honestly, I would relegate XML to application configuration. Trying to communicate with it with something like HTTP requests/responses is absurd.

When you can get the data as XML, verify via its schema externally and then transform it via XSLT, it's not. Also, it's way better in transferring/storing big, complex intricate data like 3D objects.

I remember playing with an invoice data in XML sending it via email and opening it in a browser being beautifully shown in all it's visual glory using an XSLT directive in just one line at the top of the data file. Absolutely amazing. I wondered all the implications and applications of just transmitting data that knew how to present itself to the user

Re: JSON vs. XML

#80
post #70

I remember one time designing the simplest and most readable data format ever and came up with Dixy [0] after removing all I could and still make it usable I'm leaving it here because it will never be used for anything but at least it may inspire somebody design a better format with simplicity in mind [0] https://github.com/kuyawa/Dixy

Why will it never be used for any thing? I like it. Thank you for sharing.
Post reply on HN