YAML vs Json

  • 3
    I find yamel bewildering
  • 8
    Yaml for required manual editing and config, json for system to system
  • 5
    Yaml for config, jsonl for records.
  • 2
  • 3
    @rutee07 is that a secret message? TL? hm?
  • 6
    @alexbrooklyn High on Thick Marijuana Leaves.
  • 3
    YAML's good for config, but if the user don't have to change anything, then I'd go for JSON
  • 3
    Rutee whatchoo know about flower 😘
  • 3
    @SortOfTested I wish I knew it better..
  • 4
    JSON(5) for generated data, TOML for everything else
  • 6
    Yaml for python users who care about functional whitespace. Json for everyone else.
  • 2
    @rutee07 Thick Leaves with Boiling Water 😋
  • 1
    If u wanna get funky, use XML
  • 3
  • 6
    Yaml is for me a broken concept.

    I don't know how why the idea to use whitespace / non printable characters based blocks seems to be popular... Python did it... And every one falls now or then on it's nose thanks to it.

    One reason that seems to be even more popular is to safe keystrokes I guess - seems to be popular, too.

    For me it boils down to one important no go: Omitting information and hence correctness out of lazyness.

    Whenever I can I avoid yaml as much as possible.... It's just stupid that you'll have to at least let an parser run over it to be sure you didn't fuck up...

    Especially in larger configuration files it's just a pain in the arse
  • 3
    When it comes to configuration wich you do not want to write in the language your are writing the software in, YAML is king.
    I like:
    - Enforced proper indenting, making the data structure parsable at a glance.
    - Still relatively lightweight when stripping the features you don't need.
    I dislike:
    - References. They are basically an invitation for expansion bombs.
    - Type annotations. I like my configs to only have the most basic types (bool, number, UTF-8 text). Which are checked/validated and translated to more specific types by specialized parsers after the YAML parser did its work.
    - That i have to google for the right markup for text types every time.

    JSON is good for RPCs and other machine-to-machine communication. It is even more lightweight than YAML and still readable enough for a developer in debug output.

    Just avoid XML if you can. It is the definition of bloat and comes with some nasty designed-into-the-language exploit surface wich you have to carefully mitigate.
  • 6
    Without a doubt -- json.

    I know yaml is designed to be lightweight and readable, yada yada.

    Lightweight it is! Can't argue with that. But readable...? Not quite. Sometimes indentations visually appear in the same level as parent item [lists]. It's hard to know where you are in a list of objects [in json terms], a critical prod data fuckup is no more but a single space away [unfortunately it's a true story].

    With json you always know where you are - just find the nearest structure boundary ([ or {). And it's hell of a more difficult to make a structural mistake and have a valid json at the same time -- you'll have your boundaries fucked up and you will be forced to review the whole thing and fix it.
  • 4
    tabs > spaces

  • 3
    No matter whether you go for YAML or JSON - you are _always_ just one typo away from messing up the data in some way. Sometimes it still parses, sometimes it doesn't.
    JSON might be slightly more brittle when it comes to syntax (wich is a good thing for catching typos). But i experienced YAML to always be far more readable than JSON, wich also leads to less typos in the first place...

    For actual typo-detection in human-provided configuration, you need to use a more redundant language. Numbers could for example be written as text ("nine" instead of "9")...
    For obvious reasons, such redundant configuration language is enforced nowhere in IT (although numbers are written as text on cheques in my country and true/false are almost never configured as "1"/"0" in example configuration).
  • 3
    Downsides of YAML:

    Downsides of JSON:
    it adds a lot of markup and escaped values
    harder to read / write
    no comments

    That being said I don't necessarily say you should use JSON as YAML is clearly a better choice when readability is a priority, but there's a lot to consider if you choose YAML, especially in untrusted environment or when communicating parties don't use the exact same implementation.
  • 2
    Y-combinator annointed markup language
  • 2
    Whichever one has built-in support so i don't have to write more fucking code or import more fucking modules.
  • 2
    YAML remains a nightmare.
  • 2
    YAML is inherently harder to read because you literally cannot see the characters that will break it.
  • 2
    neither. Put settings on a regular . txt file, read them and parse the required settings etc.

    Also available options: environmental variables everywhere.
  • 1
    Wich data format would your configuration text file contain?
  • 1
    Depend for config file i use yaml ... For ajax i use json
  • 2
    I see you also docker on .net core 😘
  • 3
    .INI — at least as readable and lightweight as the rest of them and far harder to manually screw up ;)
  • 1
    @Flygger why I haven't thought about that?

    Oh yeah the f**king (forced) 6 decimal in floats.
Add Comment