Readit News logoReadit News
nikeee · a year ago
I think it allows for too much. I was glad that JSON only supports double-quoted strings. It is a feature that removes discussions about which quotes to use. Or even whether to use quotes at all (we still need them for keys with colons or minus in it, so what gives?).

The only thing that JSON is really missing are comments and trailing commas. I use JSONC for that. It's what VSC uses for the config format and it works.

selcuka · a year ago
> The only thing that JSON is really missing are comments and trailing commas.

The reason JSON doesn't have comments [1]:

    I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't.

    Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.
[1] http://archive.today/8FWsA

eviks · a year ago
The reason never made much sense, anything can be abused, and the comment use case is easily way more important, and your suggestion doesn't help with eg syntax highlighting tools for your config that will treat comments as syntax errors, and also lose the ability to roundtrip, so your app can't edit user configs
hansvm · a year ago
That doesn't make it a good reason. People are placing those directives into json docs anyway, but instead they're relying on nobody causing a namespace collision with their special key whos associated value has the directives of interest.
hn_throwaway_99 · a year ago
FWIW, I'm well aware of Crockford's rationale, I think it's some of the dumbest rationalization I've heard, and time has shown that it was a giant mistake.

Trying to prevent programmers from doing something "because they may 'misuse' comments" is asinine to the extreme. This is not like removing a footgun, it's trying to dictate how you think programming should be done. This is particularly hilarious because I've instead seen tons of horribly hacky workarounds for JSON's lack of comments, e.g. "fake" object entries like "__previousKey_comment": "this is a comment for previous key", or even worse, putting two entries with the same key since the second key should "win", and thus making the first entry the comment.

As for his second point, "Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser." - just look at the everlasting shit show that is package.json since it can't support comments, because lots of NPM tools actually write to package.json, so there is no guarantee that other tools will be able to read package.json if it includes comments.

I think the thing that I hate most about Crockford's rationalization of not having comments is that you have to have your head stuck 10 feet in the sand to pretend that somehow the lack of comments is a good thing with the benefit of hindsight. I guess I could understand if Crockford's position was "Yeah, originally I thought it was better to keep them out because I was concerned about misuse, but now in retrospect to see the much larger problems it causes, and I realize it was a mistake." But instead he just keeps pushing his original crappy opinion on this topic.

gregoriol · a year ago
So instead of comments with parsing directives, people use underscore prefixed keys to keep metadata and comments, that's not a win at all
nurettin · a year ago
We should call this "The Crockford Fallacy". Destroying something valuable in fear of a perceived threat.
adamc · a year ago
One way to bifurcate the world is that there are people who tend to restrict options to prevent misuse vs. people who tend to enable options to the positive uses easier. I fall in the latter camp. Preventing errors by restricting options also prevents positive uses that make life better.

We get to choose what approach we take. I prefer the "give them the rope they might need" philosophy. If they hang themselves, oh well.

Zamicol · a year ago
Software developers very much so care about best practices.

All that needed to be said was, "Using comment programmatically is bad practice. Don't do it."

naikrovek · a year ago
> I removed comments from JSON because I saw people were using them to hold parsing directives

there's always someone putting actual logic in comments, and when I rule the world, those people are all going to be put on an island by themselves and they're going to have to deal with each other.

pbreit · a year ago
It might be abused and you can just pipe it through a preprocessor are not very good reasons.
thwarted · a year ago
Abuse of comments is not an academic, theoretical consideration.

https://www2.jwz.org/doc/cddb.html

(Unfortunately, because jwz blocks HN referrals, you can't click on this link, but will need to copy it into the address bar)

SV_BubbleTime · a year ago
And that is fine reasoning, the workaround is not for me… but the larger issue is an inventor kneecapping something by stating how you should use it.

It’s not like there isn’t another side to this argument.

fuzzythinker · a year ago
That's a terrible reasoning for requiring an extra toolchain.
nigeltao · a year ago
JWCC literally stands for JSON With Commas and Comments.

JWCC is also what Tailscale call HuJSON, as in "JSON for Humans", which as amusingly also what json5 claims to be.

https://github.com/tailscale/hujson

lioeters · a year ago
There's also HJSON, which stands for Human JSON.

https://hjson.github.io/

It has implementations in JavaScript, C#, C++, Go, Java, Lua, PHP, Python, Rust.

Deleted Comment

404mm · a year ago
Exactly! Trailing commas (for cleaner commits) and comments are the only pain points I ever felt.

On the other hand:

> leadingDecimalPoint: .8675309

This is just lazy. Can we discuss in depth how much time you saved by skipping the “0” in favor of lesser readability?

> andTrailing: 8675309.,

This doesn’t mean anything to me.

SkyBelow · a year ago
If we consider sigfigs, then isn't 100 and 100. two different numbers given one has a single significant digit and the other has 3? For 101 and 101. it doesn't matter because both have 3 significant digits. Then again, one may argue that it is better to write 1e2 and 1.00e2 instead of 100 and 100.. It also avoids the weirdness of the double period if the number with a dot ends a sentence.

On a personal level, I also don't like ending a number with a . because my brain immediately parses it as a sentence ender and it interrupts my reading flow.

crazygringo · a year ago
It has nothing to do with laziness in typing.

It's just not wanting to keep track of more rules. If you've only ever used languages where a leading decimal point is allowed, it's a pain point to suddenly have to remember that it isn't here, and for no obviously intuitive reason.

It's about wanting to avoid unnecessary conceptual friction. Not lazy keyboard usage.

(Heck, your second example uses an extra keystroke. And it's perfectly readable to me, based on the languages I use.)

_blk · a year ago
I never understood leading dot until I understood that native speakers indeed say ".3" (point three).

Trailing makes it a floating point type instead of an integer

efitz · a year ago
It’s not about readability, it’s being realistic about other humans and making software robust in the presence of common, trivial, unambiguous “errors”.

Reference: Postel’s Law

https://www.laws-of-software.com/laws/postel/

xelamonster · a year ago
Well what's more readable, .8675309 that is understood to have an implicit zero, or the parser giving up and unexpectedly making it a string? Maybe it's not your preference but I can't see any problem with making this more robust. The trailing one is strange to me but leaving off a leading zero isn't unusual at all for written numbers in my experience.
appplication · a year ago
As a data guy I find myself running into JSONL a fair bit. It was surprising to me that it’s not supported in the vanilla spec.
compootr · a year ago
as a student experimenting with millions of records of data, its pretty nice!
nox101 · a year ago
JSONC is fine but VCS should have named its configuration files settings.jsonc since the files are not JSON and will not be parsed by JSON parsers.
wvh · a year ago
I agree, if one of those myriad alternatives is to be used, at least specify that clearly.
conaclos · a year ago
I agree 100%. It is such a pain to write tools that have to account for all these exceptions.
AdieuToLogic · a year ago
> The only thing that JSON is really missing are comments and trailing commas. I use JSONC for that.

YAML[0] supports JSON formatted resources and octothorpe ('#') comments as well. I didn't see anything in the spec specifically allowing for trailing commas however.

Here is an exemplar using the Ruby YAML module:

  #!/usr/bin/ruby
  
  require 'yaml'
  
  
  puts YAML.load(
    %/
      # YAML is a strict superset of JSON, which
      # means supporting octothorpe end-of-line
      # comments is supported in JSON formatted
      # YAML if and only if the content is multi-line
      # formatted as well (like this example).
      {
        # This is valid YAML!
        "foo" : "bar"
      }
    /
    )
  
0 - https://yaml.org/spec/1.2.2/

nine_k · a year ago
The problem of yaml is that it allows too much. It allows unquoted strings, and those can be interpreted by the parser as numbers, timestamps, booleans, etc. This is a source of many fooguns.

Use of indentation to denote nesting can sometimes be an anti-feature, too, because while using that the format does not provide a way to make certain that the entire stream has been read (parens balanced). This may lead to problems or even exploits.

Pure JSON is so painful for human consumption though, I willingly choose yaml if it's the only alternative.

JSON5 may indeed be a sweet spot between human-friendliness and lack of nasty surprises.

ratorx · a year ago
Whilst YAML is an option, if the choice is between having the unnecessary extra features of JSON5 or YAML, JSON5 seems like the clear winner.

Allowing multiple types of quotes may be an unnecessary feature but it is a clear lesser evil compared to the mountain of footguns that YAML brings with it.

hippospark · a year ago
Also take a look at ASON [1]. ASON is a data format that evolved from JSON, introducing strong data typing and support for variant types.

[^1] https://github.com/hemashushu/ason

thayne · a year ago
> The only thing that JSON is really missing are comments and trailing commas.

And multi-line strings. You don't always need that, but when you do, it's absence is very painful.

stkdump · a year ago
Agreed. The workaround (arrays of strings) isn't great as it means an extra transformation has to be done between the reader and the usage. I would go so far as to say this is more important than comments.
numbsafari · a year ago
Allowing for leading decimals without a preceding zero also seems like shifting a whole class of errors right.
xelamonster · a year ago
I'm not a fan of forcing single or double quotes because escape codes are such a pain to deal with and to me make things significantly harder to read than an inconsistent quoting style ever could.
yread · a year ago
I just add another property with noncolliding name as a comment.

"//key":"this is here so that foo bars", "key":"value",

valid JSON. Most software handles extra propertiesjust fine

n144q · a year ago
> the only thing that JSON is really missing

Depending what you use JSON for, "Numbers may be IEEE 754 positive infinity, negative infinity, and NaN." could be a huge plus.

Pxtl · a year ago
> The only thing that JSON is really missing are comments and trailing commas. I use JSONC for that. It's what VSC uses for the config format and it works.

I disagree. Human-friendy multiline strings aren't really optional for a serialization format that will inevitably also be used as a config format sometimes because those are the same problem.

Cthulhu_ · a year ago
The choice of single vs double quotes means you can use single quotes if the contents contain a double quote and vice-versa. With JSON containing shell scripts (looking at package.json scripts) that's a valuable addon imo.
simoneau · a year ago
Someone just needs to write “JSON5: The Good Parts” and an aggressive linter to enforce it.
catlifeonmars · a year ago
Why not just a parser? Should be easy enough.
taeric · a year ago
JSON only allowing double quotes is something I have grown to not care about, but as someone that was using JavaScript object literals before JSON became a thing, I confess I do not understand why it is an advantage? If you were at a place where it was a heavy discussion on what quote to use, I'm forced to think there were deeper cultural issues at play?

Don't get me wrong, the ubiquity of JSON speaks for itself and is the reason to use it. But, to say it has tangible benefits feels very dishonest.

bawolff · a year ago
As much as i like this (yaml goes way too far, but trailing commas and comments would make json much nicer. I actually think this spec goes too far with single quotes) i hate that it is named json5. I think its unethical to imply you are the next version of something if you don't have the blessing of the original author.
Dylan16807 · a year ago
Even when the original author said it was "discovered"?

JSON5 is closer to "javascript object notation" than JSON itself. It's partly an update and partly a removal of arbitrary restrictions.

yosito · a year ago
Except that JSON is a valid JavaScript object, and JSON5 is not.
papa-whisky · a year ago
I think the name just means that it sits in-between JSON and ES5 (i.e., it's a superset of JSON and subset of ES5).

edit: well as this comment thread indicates, the name is pretty confusing for everyone :)

yonran · a year ago
The parser for tsconfig.json (typscript.parseConfigFileTextToJson(fileName, jsonText) or parseJsonText) seems to be what you want; I wonder if there is a name for that format.
bobbylarrybobby · a year ago
I think JSONC is the term for json with comments and trailing commas
wvh · a year ago
Could also be construed as paying homage, though. I think the number 5 here is a reference to congruence with ECMA Script 5 rather than to imply a version of JSON.
The_Colonel · a year ago
Single quotes are useful for string contents containing many double quotes (e.g. XML).
bawolff · a year ago
Lots of things are useful. I think json has been succesful largely because it preferred minimalism over usefulness.
j1elo · a year ago
I always thought that the name JSON5 pretends to be nothing more than a pun on Michael Jackson's original band, The Jackson 5. It sounds too similar!

If it didn't originate from that, what else?

bawolff · a year ago
The project description describes it as json plus syntax from emcascript 5.1 (commonly called ES5) [the official name of javascript is emcascript]. I imagine that is where the name comes from.

Although it doesn't really make sense since most of the stuff they add predates ES5.

dcre · a year ago
Ha. There is no way that’s what it means unless you read that somewhere.
benkaiser · a year ago
I agree with the others that ES5 is likely where it came from, but my mind also jumped to The Jackson 5.
zeven7 · a year ago
I assumed it was a play on HTML5 ¯\_(ツ)_/¯
yashap · a year ago
I’m a fan of JSON5. A common criticism is “we’ve already got YAML for human readable config with comments,” but IMO YAML’s readability sucks, it’s too hard to tell what’s an object and what’s an array at a glance (at least, with the way it’s often written).

When dealing with large YAML files, I find myself frequently popping them into online “YAML to JSON” tools to actually figure out WTF is going on. JSON5 is much easier to read, at least for me.

stackskipton · a year ago
Those two criticisms of YAML are at bottom of my list. Space as delimiter and lack of strict typing is what screws me over on daily basis as SRE.
Pxtl · a year ago
This. I hate how all these serialization/config formats come out of dynamically typed languages. Static typing is a must. Then so many classes of errors go away.
yashap · a year ago
Fair, YAML has a lot of usability warts, and those suck too. Although personally I really do hate how tough it is to tell apart arrays and objects, at least with the most common YAML array/object style.
couscouspie · a year ago
Just in case you didn't know: With https://github.com/mikefarah/yq you can just immediately translate YAMLs like

  yq some.yaml -o json

mdaniel · a year ago
A reimplementation of jq in golang supports reading yaml and, of course, emits json: https://github.com/itchyny/gojq#:~:text=supports%20reading%2...

That one is likely more relevant than yq since folks in the json ecosystem are far more likely to be familiar with jq's syntax and thus using gojq is "one stop shopping," not to mention that its error handling is light-years beyond jqlang's copy

AdieuToLogic · a year ago
> When dealing with large YAML files, I find myself frequently popping them into online “YAML to JSON” tools to actually figure out WTF is going on.

YAML is a strict superset of JSON, so defining the former in the syntax of the latter is fully supported by the spec. Perhaps not by every YAML library, to be sure, but those which do not are not conformant. From the YAML spec[0]:

  The YAML 1.23 specification was published in 2009. Its 
  primary focus was making YAML a strict superset of JSON.
0 - https://yaml.org/spec/1.2.2/

Centigonal · a year ago
I'm confused about your point about YAML being "strict superset of JSON" leading to being able to convert YAML to JSON.

If YAML is a strict superset, wouldn't that mean that YAML must have at least one feature that is not part of JSON? Wouldn't that make it impossible to define all YAML files as valid JSON?

yashap · a year ago
For sure, but most YAML you actually encounter does not use much in the way of JSON syntax, it looks a lot more like this: https://devblogs.microsoft.com/devops/wp-content/uploads/sit...

Where arrays and objects just look too similar (IMO), white space is significant, most strings are unquoted, etc. And personally I find it quite difficult to really understand what’s going on there, at a glance, compared to JSON (or JSON5).

marcyb5st · a year ago
What's your take on prototxt files? In my opinion it is the most readable format since you don't need square brackets for repeated fields/arrays.

Additionally plugins let you link your prototxt file with the corresponding proto so you can spot errors right away.

yashap · a year ago
Don’t have any experience with them.
BurningFrog · a year ago
If you already have a bunch of JSON documents, you can keep using them with JSON5.

That's a big advantage compared to converting to YAML.

knowsuchagency · a year ago
same is true of YAML as a JSON superset
alex-robbins · a year ago
It's too bad EDN [1] hasn't seen much adoption outside of the biblical paradise that is the Clojure ecosystem.

[1]: https://en.m.wikipedia.org/wiki/Clojure#Extensible_Data_Nota...

In fact, there doesn't seem to be a spec or standard for it, outside of the de facto standard used by Clojure and the programs in its orbit. I guess nobody's bothered to write a standard, because the people who are already using EDN are doing fine without one, and the people who aren't either don't know what it is or don't see its value.

ledgerdev · a year ago
https://github.com/edn-format/edn

I too love edn, but unfortunately most other languages lib abandoned (eg. https://github.com/edn-format/edn-dot-net ). Looking around python seems relatively maintained which is great https://github.com/swaroopch/edn_format/issues

sundarurfriend · a year ago
Is there an example of what it looks like in practice? The Wikipedia link above doesn't have it, its citation http://edn-format.org/ seems like it doesn't exist anymore, and this github page doesn't show a sample either.
avodonosov · a year ago
Dont be pessimistic - you are still free to used it.

I used EDN outside of Clojure. The system needed a relatively large amount of config files, and I chose EDN as a better JSON. Looks familiar to everyone, but supports comments - the primary motivation for that choice.

JSON-5 allows a single trailing comma. EDN simply ignores commas. You can have them, trailing or not. But they are really redundant and incur visual noise.

Perhaps EDN can also be improved, but that's a good format. Convenient.

ledgerdev · a year ago
> Perhaps EDN can also be improved

How might you improve EDN?

bearjaws · a year ago
The whole reason JSON rules the world is because it's brutally simple.

We already have 5+ replacements that are far more robust(XML, YML) and IMO they are not great replacements for JSON.

Why? Because you can't trust most people with anything more complicated than JSON.

I shutter at some of the SOAP / XML I have seen and whenever you enable something more complicated inevitably someone comes up with a "clever" idea that ruins your day.

JoshTriplett · a year ago
> The whole reason JSON rules the world is because it's brutally simple.

I don't think that's the primary reason. JSON is pervasive because it started out being trivially parseable by JavaScript going back to when people just evaluated it, even before browsers had ridiculously high-perfomance safe JSON parsers. All the other formats are still harder to work with from JavaScript.

If not for that, personally I'd advocate TOML, which is incredibly simple.

bobbylarrybobby · a year ago
I find toml impossible to both read and write in all but the simplest cases.
peeters · a year ago
> trivially parseable by JavaScript going back to when people just evaluated it

Comments and all, ironically.

I mean sure, "and all" would frequently include script injections etc, but you can't argue it wasn't more feature rich!

Zamicol · a year ago
We use JSON5 for two reasons:

1. Comments 2. Trailing commas

We don't use any other JSON5 features, which are primarily just that numbers may be encoded in hexadecimal and field names may have quotes elided.

We typically encode values with RFC 4648 base 64 URI canonical with padding truncated (b64ut) with values too large to be a JSON number, so hex isn't useful anyway. We haven't found that omitting field name quotes is a big deal.

dcreater · a year ago
Why not use JSONC then?
yencabulator · a year ago

    is yaml robust: no

Diti · a year ago
Ever since YAML 1.2, released in 2009(!), your YAML example would parse your input as “is yaml robust” for the key, and “no” for the value.
layer8 · a year ago
The only reason JSON got any traction is because it was a subset of client-side JavaScript and thus natively supported in the browser.
eterevsky · a year ago
To be precise, JSON was a replacement for XML, not the other way around. And the problem with XML was that it's way to verbose and difficult to write by hand, so it's exactly the opposite of the direction YAML/JSON5/... are taking.
postalrat · a year ago
The problem with XML was people were using it for every possible thing they could think of and 90% of those ideas were garbage.
Zamicol · a year ago
Hijacking for a random concern:

I love JSON, but one of the technical problems we've ran into with JSON is that the spec forgot about all special characters.

I actually noticed it when reading Douglas Crockford's 2018 book, "How JavaScript Works". The mistake is on page 22.9 where it states that there are 32 control characters. There are not 32 control characters. There are 33 7-bit ASCII control characters and 65 Unicode control characters. When thinking in terms of ASCII, everyone always remembers the first 32 and forgets the 33rd, `del`. I then went back and noticed that it was also wrong in the RFC and subsequent revisions. (JSON is defined to be UTF-8 and is thus Unicode.)

Below is a RFC errata report just to point out the error for others.

Errata ID: 7673 Date Reported: 2023-10-11

Section 7 says:

The representation of strings is similar to conventions used in the C family of programming languages. A string begins and ends with quotation marks. All Unicode characters may be placed within the quotation marks, except for the characters that MUST be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F).

It should say:

The representation of strings is similar to conventions used in the C family of programming languages. A string begins and ends with quotation marks. All Unicode characters may be placed within the quotation marks, except for the characters that MUST be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F, U+007F, and U+0080 through U+009F).

Notes:

There are 33 7-bit control characters, but the JSON RFC only listed 32 by omitting the inclusion of the last control character in the 7-bit ASCII range, 'del.' However, JSON is not limited to 7-bit ASCII; it is Unicode. Unicode encompasses 65 control characters from U+0080 to U+009F, totaling an additional 32 characters. The section that currently reads "U+0000 through U+001F" should include these additional control characters reading as "U+0000 through U+001F, U+007F, and U+0080 through U+009F"

---

I've chosen `del` to be my favorite control character since so many engineers forget it. Someone needs to remember that poor little guy.

rswail · a year ago
Not to mention that it was set to be 127 so that it would be 8 holes punched out on paper tape, so you could use it to correct a paper tape by backspacing the tape by one position and hitting del.
jmull · a year ago
The errata seems like a mistake.

Makes more sense to drop the term "control character" and leave the specification of which characters are not allowed as-is.

The cat's already out of the bag on this one. Changing the characters now will create a lot of invalid JSON in the world, with more being generated all the time.

Zamicol · a year ago
That's a reasonable approach, however I would argue it's incomplete without acknowledging the historical context. How could the specification explicitly acknowledge this as technical debt from the original design rather than letting readers assume it was an intentional architectural choice? Such context informs implementers about the constraints they're working with.
sethops1 · a year ago
May I suggest using TOML, which in my experience has been the perfect blend of human readability while having good tooling.

https://toml.io/en/

hombre_fatal · a year ago
Like YAML, it's only better in the simple case where everything is top-level and there's only one level of nesting.

Once you want to have arrays of nested objects or objects with arrays, I immediately wish I was just reading JSON so I knew where I was in the tree.

And for that reason, I don't think it's a full contender. I want an answer for the hard cases like nested data, not just another way to write the simple cases which is what TOML is.

For example,

    [[a.b]]
    x = 1

    [a]
    y = 2
Versus:

    {
      "a": {
        "b": [ { "x": 1 } ],
        "y": 2
      }
    }
It's easy to complain that the latter is noisier. But that's nothing compared to being clear.

zahlman · a year ago
It's not made explicit in the documentation, but TOML is very nearly a superset of JSON - just using `=` to separate key-value pairs instead of `:`, and requiring top-level names to be given explicitly, and requiring the "inline" bits to be on a single line. In TOML, your example can equivalently be:

    a = { b = [ { x = 1 } ], y = 2 }
(And yes, that can be the entire document; you can have an inline table before the first table header.)

Of course, this doesn't help if you want the top level to be an "array" rather than an "object" (in JSON parlance), or if you want the entire document to represent a single primitive value. But these uses are discouraged at best anyway.

But really the goal of TOML is to highlight the location of important parts of the deserialized tree structure (hence the ability to use arbitrary long dotted paths in table headers) rather than the structure itself. It's IMO a beautiful implementation of the idea "flat is better than nested" from the Zen of Python, and it neatly sidesteps an issue I asked about many years ago on Stack Overflow (https://stackoverflow.com/questions/4372229 - the question was rightfully closed, as this sort of discussion doesn't fit the Q&A format; but it made sense to ask at the time).

I don't know if a direct comparison of TOML to YAML is fair. Among other differences, the standard way to parse YAML in Python involves a third-party library that brings in a ~2.5 MB compiled C library. Every TOML implementation I encountered - including the one that made it into the standard library - is pure Python.

arp242 · a year ago
Your TOML is rather convoluted, a more normal way to write it would be:

  [a]
  b = [{x = 1}]
  y = 2
Or alternatively:

  a.b = [{x = 1}]
  a.y = 2
Some parsers allow newlines in TOML inline tables, so you can do:

  a = {
    b = [{x = 1}],
    y = 2,
  }
That's supposed to be in the next TOML standard, but that seems indefinitely stalled as the (only) maintainer has seemingly lost interest and there hasn't been any movement for a long time.

okanat · a year ago
This is also the reason I prefer XML to JSON when things really got complex. XML is verbose but it is very readable on long form. I wish Rust actually used JSON or XML as Cargo file format.
viraptor · a year ago
Their dictionaries and arrays split into ini-like sections are not very readable though. The double [[ is just nasty and not possible to apply in all situations (array in map in array).
zahlman · a year ago
> not possible to apply in all situations (array in map in array).

Yes, that's largely why inline tables and arrays exist:

   >>> tomllib.loads("""
   ... [[outer]]
   ... first = [1, 2, 3]
   ... second = [4, 5, 6]
   ... 
   ... [[outer]]
   ... third = [7, 8, 9]
   ... fourth = [10, 11, 12]
   ... """)
   {'outer': [{'first': [1, 2, 3], 'second': [4, 5, 6]}, {'third': [7, 8, 9], 'fourth': [10, 11, 12]}]}

rixrax · a year ago
This should have been named NOTjson-somethingv5. Or similar. Now it is far from obvious for the uninitiated that this might not be the 'latest' version of JSON. And then they end up using this incompatible format by accident, when in all likelihood standard JSON would serve equally well or better in 95% of the use cases.