• LiveLM@lemmy.zip
      link
      fedilink
      English
      arrow-up
      30
      ·
      21 hours ago

      The json spec is not versioned. There were two changes to it in 2005 (the removal of comments

      See, this is why we can’t have nice things.

      • Ephera@lemmy.ml
        link
        fedilink
        English
        arrow-up
        13
        ·
        17 hours ago

        I can kind of understand it after having to work with an XML file where users encoded data into comments for no good reason. But yeah, it does make JSON awkward for lots of potential use-cases.

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

            They’re not supposed to contain data, but some parsers will allow you to access what’s written into comments. And so, of course, someone made use of that and I had to extract what was encoded basically like that:

            <!--
                Host: toaster,
                Location: moon,
            -->
            <data>Actual XML follows...</data>
            

            My best guess is that they added this data into comments rather than child nodes or attributes, because they were worried some of the programs using this XML would not be able to handle an extension of the format.

            • flying_sheep@lemmy.ml
              link
              fedilink
              arrow-up
              3
              ·
              5 hours ago

              That’s why they make sense in code and config files. JSON is neither, despite the insistence of far too many people to write configuration in it.

              • tetris11@feddit.uk
                link
                fedilink
                English
                arrow-up
                3
                ·
                edit-2
                5 hours ago

                In an ideal world, yes. In a locked down world where you have access only to 1/4 the codebase or your job is more ontology-focused, all you have access to might be the JSON. Leaving a comment or two about why a particular value or hierarchy is as it is is sometimes more clear than writing up a seperate README that no one will read

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          12 hours ago

          This would undoubtedly, unquestionably happen, and it would break JSON. The only reason it works so well is because comments aren’t allowed.

    • onlyhalfminotaur@lemmy.world
      link
      fedilink
      arrow-up
      9
      arrow-down
      2
      ·
      20 hours ago

      Almost all of those issues are solved by explicitly quoting your strings, the author even acknowledges that. Yeah it’s annoying that yaml lets you do otherwise, but the title is a bit dramatic.

      • Appoxo@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        1
        ·
        1 hour ago

        Coming from powershell scripting, every string is put in quotes and to be printed strings with variables are put in $($var) (e.g. Write-Host "Example-Issue: $($IssueVariable)")
        Saves me the trouble of hoping that $($IssueVariable) isnt interpreted as a string by PowerShell.