Ask A Question

Notifications

You’re not receiving notifications from this thread.

Do we need an alternative to JSON?

Charlesmartin asked in Javascript

Hey everyone,

Maybe this is a controversial topic but I've been wondering for a while about a JSON alternative. Being able to serialize objects, array, string, numbers and booleans is nice and fit 99.9% of needs, but there's still that 0.1% left behind. I'm thinking serializing dates, sets, functions?, refere nces (more on that later) and other data structures we can use in "native" JS. fedloan

On the other hand, it's really convenient to have a standardized data parser/serializer that's super simple and thus works across many programming languages, still is human readable/writable enough. irs.gov

But I've seen quite a few project (JSON graph, netflix's Falcor) trying to shove in graphs under a JSON notation, other smaller libraries scanning strings to see if one matches a date format or a RegEx that I feel like we hold to JSON a little bit too much, and maybe a slight evolution wouldn't be bad. easybib

On the references side, I find it really funny that a core property of JS variables (objects and arrays are just references) isn't carried to the serialized version. Makes more sense on the human readable/writable sense, but becomes very verbose, especially in the graphQL age (which by the use of JSON should be called Graph2TreeQL IMO), and gets wrecked by circular object which are just fine a easy to serialize if you add a way to do it.

Am I alone in this or are there other people sometimes frustrated with JSON limitations? And if yes, what is the biggest "I wish it could do X" be?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 81,842+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.