• CreamyJalapenoSauce@piefed.social
    link
    fedilink
    English
    arrow-up
    9
    ·
    5 hours ago

    Not-so-fun fact: if you’re transferring a yaml or toml file and the transfer is incomplete, the receiving app may not even know! Yaml and toml both have a good chance of being apparently valid when cut off randomly. This doesn’t impact JSON because of the enclosing {} or [].

    • Ephera@lemmy.ml
      link
      fedilink
      English
      arrow-up
      9
      ·
      edit-2
      3 hours ago

      Counterpoints:

      • TOML is intended for configuration, not for data serialization, so you shouldn’t be sending it over the wire in all too crazy ways anyways.
      • Most protocols will have a built-in way of knowing when the whole content has been transferred, typically by putting a content length into the header.
      • Having to wait until the closing } or ] can also be a disadvantage of JSON, since you cannot stream it, i.e. start processing the fields/elements before the whole thing has arrived. (You probably still don’t want to use TOML for that, though. JSONL, CSV or such are a better idea.)
  • thebestaquaman@lemmy.world
    link
    fedilink
    arrow-up
    14
    ·
    5 hours ago

    I’ve never gotten to be good friends with toml. I’ve never liked that the properties of some thing can be defined all over the place, and I’ve definitely never liked that it’s so hard to read nested properties. JSON is my friend.

    • Ephera@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      ·
      4 hours ago

      They serve largely different use-cases. JSON is good for serializing data. TOML is good for configuration.

    • Ephera@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      ·
      4 hours ago

      Well, TOML is essentially just an extension of the INI format (which helped its adoption quite a bit, since you could just fork INI parsers for all kinds of programming languages).

      And then, yeah, flattening everything is kind of baked into INI, where it arguably made more sense.
      Although, I do also feel like non-techies fare better with flat files, since they don’t have to understand where into the structure they have to insert the value. They just need find the right “heading” to put the line under, which is something they’re familiar with.