Jump to content

Recommended Posts

Seems to me that is not very smart format/standard.

 

If some service produce it and have to use it, then for sure need an parser. But I would steer away from that format if just can.

 

Little bit sketchy.

 

-Tee-

Share this post


Link to post

The mORMot parser supports "extended JSON", as used with MongoDB: field names can be without quotes.
It follows in fact the JavaScript object declaration syntax.

 

Internally - between mORMot client and server - it will use it to slightly reduce size and enhance performance.
For regular clients (e.g. JavaScript), it will server standard JSON with quoted field names.
As @Lars Fosdal states, a rigid format seems better when exchanging data between heterogeneous ends.

Edited by Arnaud Bouchez
  • Like 1

Share this post


Link to post
3 hours ago, David Heffernan said:

Yeah, seems pointless. Use YAML if you want more readable files. 

I second that!

Share this post


Link to post
Guest

That looks scary. Parsing JSON is already a minefield.

Share this post


Link to post

It's not scary...it's human readable :classic_biggrin:

 

It's used extensively in the micro services world along with the radix (trie) tree. BTW, anyone knows any implementation of that one?

 

 

 

Share this post


Link to post

The worse about Relaxed JSON is that it is not reversible.

It may change the values.

For instance, { number: 1.0 } will become { number: 1 } which is not the same.

 

So for an exchange format, I would never use Relaxed JSON.

For a settings local file, edited via vim or nano - why not? but as @David Heffernan stated, YAML (or TOML) sounds like better candidates.

Share this post


Link to post

I don't think that toml is widely used, although I admire its goals. I also believe that it has some limitations. And I don't think there is a Delphi parser for it. 

Share this post


Link to post

Off the top of my head: One is an integer the other is a floating point.

Share this post


Link to post
22 hours ago, Arnaud Bouchez said:

For instance, { number: 1.0 } will become { number: 1 } which is not the same.

Are you sure about that ?

Share this post


Link to post

From the relaxed JSON website:

Quote

 

If a simple-value can be parsed as a number, it will become a JSON number.

{ number: 1.0}
will become

{ "number" : 1 }

 

I still don't get what a "JSON number" is - from its json.org definition, it is any kind of number with none to any decimals...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×