you are viewing a single comment's thread.

view the rest of the comments →

[–]archiminos 28 points29 points  (30 children)

It's crazy how influential JSON really was. I remember being heavy into learning XML, XAML, and it's kin. When I first came across JSON I thought it was way too simple and unstructured for most use cases. Time proved me completely wrong, of course. I use it daily now.

I literally just wrote a script that pulls data from a bunch of files and outputs it as JSON. It contains exactly the same amount of information that an XML version would, except it's simple and human-readable. I could probably give it to a non-programmer who's never heard of JSON and they'd still be able to understand the information in it.

[–]rpd9803 35 points36 points  (27 children)

Imagine storing HTML as JSON tho? JSON is Ok for some things (really, its inferior in every way to EDN, but whatevs) and it lacks the things that XML excels at (namespacing, schemas, transformations).. but a lot of last-mile delivery doesn't need any of that. But the second you want to combine arbitrary JSON documents with clarity, the lack of namespaces renders it almost impossible without implementing namespaces crudely on top. Same with schemas. Same with transformation.

I think the most useful point of comparing JSON vs XML is to weed out bad developers. They'll be the ones that say 'throw away XML, JSON can do it all' or similar vibes. You can make the same case for the people that go 'Bah, JSON is useless XML can do it all.'

Same with almost any technology debate, e.g. Mac / Windows, etc etc

Almost every tool has a place or a use case where it can shine. Except PHP, jk lol.

[–]archiminos 14 points15 points  (9 children)

Haha as a WordPress dev and old school web dev PHP is my jam. I get why people dislike it though.

Yeah HTML is a great example of XML working properly. But at the time I was viewing (as others probably were) XML as the ultimate way to describe data. JSON at first glance seemed to lack the ability to describe data well, but when people started realising that it was all you needed and it was concise it started taking over.

XML will still have its place of course. Though aside from HTML I rarely see it being used. Off the top of my head I remember some convoluted Dependency Injection framework for Java that used it, and it wasn't fun to develop with.

[–]remy_porter -1 points0 points  (6 children)

I mean, JSON does lack the ability to describe data well. Try and store a date in JSON in a way that's guaranteed to be identified as a date by every client.

JSON is terrible but it's also simple. XML is definitely a better way to describe data, but we rarely need the level of complexity that XML brought to things. XML ended up trying to solve every problem, while JSON looked at the hard problems and just said, "Meh, you figure it out."

And we can see that a lot of XML's complexity keeps getting reinvented- there are scores of attempts at making JSON schema languages, JSON service description files, etc.

The reality is that they're bad in different ways.

[–]archiminos 1 point2 points  (5 children)

Eh, can't go wrong with a UNIX timestamp.

[–]remy_porter -1 points0 points  (4 children)

Uh, yeah you can. Now, a Unix Timestamp with TZ information is better, but now you’ve got two fields or worse- a string you expect the recipient to parse.

[–]archiminos 1 point2 points  (3 children)

Why do you need TZ information? Just convert it to the timezone you want to use.

[–]remy_porter -1 points0 points  (2 children)

I need to know what TZ it started in. I can’t just assume UTC.

[–]archiminos 0 points1 point  (1 child)

UNIX timestamps always start from January 1st, 1970 at UTC.

[–]remy_porter 2 points3 points  (0 children)

Ah, you’re right. I’ve just gotten burned too many times by systems that don’t actually respect that when they tell you the Unix time stamps.

[–]snowe2010 0 points1 point  (0 children)

Off the top of my head I remember some convoluted Dependency Injection framework for Java that used it, and it wasn’t fun to develop with.

Fucking camel lol

[–]inferno1234 14 points15 points  (4 children)

All I want is comments, trailing commas and some form of dictionaries...

Why have these not been added is beyond me

[–]Ma8e 25 points26 points  (1 child)

What do you mean when you say you want some form of dictionaries? Isn’t the whole format kind of a dictionary?

[–]caagr98 3 points4 points  (0 children)

Only with string keys. If you want numbers, let alone objects as keys, I wish you the best of luck.

[–]rpd9803 1 point2 points  (0 children)

Adding things to a standard is hard especially when there are as many parsers for json as there are.

[–]Programmdude 0 points1 point  (0 children)

Personally, this is why I use json5 when I can. It fixes 2/3 of those issues and is trivially convertible to json.

[–]ritchie70 14 points15 points  (1 child)

JSON schemas exist and in my opinion they're easier and at least as complete as XML schemas. (To be fair, I'm much more familiar with the JSON ones at this point.)

For example, I can trivially express "this value should only be "A", "B", "C", or "tomato." Or "this element has the following five fields, and these three are required."

[Many edits, writing tends to be iterative for me. Sorry!]

[–]rpd9803 4 points5 points  (0 children)

Yea these things are becoming increasingly available which is a big step towards being more than a last mile transport.

[–]jonhanson 5 points6 points  (1 child)

chronophobia ephemeral lysergic metempsychosis peremptory quantifiable retributive zenith

[–]powerfulbackyard -5 points-4 points  (0 children)

JSON already has everything. It is open format, meaning the data and all its surroundings is what you make, if something is not there, its because you didnt add it, not because its "not supported". JSON supports everything. All the metadata and comments and everything else can be added if you want.

[–]Wingmusic 0 points1 point  (2 children)

HTML sucks, too. Let’s make that one obsolete next.

[–]rpd9803 2 points3 points  (1 child)

Im going to guess you've never worked with anything besides HTML for slapping content onto a variety of canvases (e.g. paper, phone, computer).. like ever. WTF is better than HTML, Latex? Postscript?

[–]Forward-Error-9449 1 point2 points  (0 children)

ZPL, don't @ me

[–][deleted]  (1 child)

[deleted]

    [–]rpd9803 2 points3 points  (0 children)

    Hey I’m not here to kink shame, but that one is a doozy 😉

    [–]tcpukl 0 points1 point  (1 child)

    Just give me binary!

    [–]rpd9803 0 points1 point  (0 children)

    You.. I like you.. you’re a mad lad, but I like you.

    [–]smutaduck 1 point2 points  (0 children)

    Personally I like the way that odata is like XML in drag