And I’ll show you YAML

(a continuation of this post)

  • calcopiritus@lemmy.world
    link
    fedilink
    arrow-up
    31
    ·
    1 year ago

    Serializing? For serializing you probably want performance above all else. I’m saying this without checking any benchmark, but I’m sure yaml is more expensive to parse than other formats where indentation don’t have meaning.

    For human readability: it has to be readable (and writeable) by all humans. I know (a lot of people) that dislike yaml, toml and XML. I don’t know of a single person that struggles to read/write json, there is a clear winner.

    • Kogasa@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Serializing isn’t necessarily about performance, or we’d just use protobuf or similar. I agree Json is a great all rounder. Combine with JSON object schema to define sophisticated DSLs that are still readable, plain JSON. TOML is nice as a configuration language, but its main appeal (readability) suffers when applied to complex modeling tasks. XML is quite verbose and maybe takes the “custom DSL” idea a little too far. YAML is a mistake.

    • DrM@feddit.de
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      JSON would be perfect if it allowed for comments. But it doesn’t and that alone is enough for me to prefer YAML over JSON. Yes, JSON is understandable without any learning curve, but having a learning curve is not always bad. YAML provides a major benefit that is worth the learning curve and doesn’t have the issues that XML has (which is that there is no way to understand an XML without also having the XSD for it)

      • Michal@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Json should also allow for trailing commas. There’s no reason for it not too. It’s annoying having to maintain commas.