lemmy.dudeami.win
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
ruffsl@programming.dev to Programming@programming.devEnglish · 1 year ago

Everything about TOML format - Orchard Dweller

www.youtube.com

external-link
message-square
42
fedilink
  • cross-posted to:
  • python@programming.dev
  • rust@programming.dev
1
external-link

Everything about TOML format - Orchard Dweller

www.youtube.com

ruffsl@programming.dev to Programming@programming.devEnglish · 1 year ago
message-square
42
fedilink
  • cross-posted to:
  • python@programming.dev
  • rust@programming.dev
Everything about TOML format
www.youtube.com
external-link
What is this TOML?Visualizer:https://toml-to-json.orchard.blog/Code:https://github.com/orcharddweller/toml-to-jsonTOML spec:https://toml.io/en/v1.0.0#TOML #t...
  • Visualizer:
    • https://toml-to-json.orchard.blog/
  • Code:
    • https://github.com/orcharddweller/tom…
  • TOML spec:
    • https://toml.io/en/v1.0.0
  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    TOML is mainly for humans to write, certainly not a good choice if you’re programmatically writing files - comments and formatting would be lost.

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

      It all depends on the library you use. Rust has you covered with toml_edit. It is what is used for all the cargo commands editing the Cargo.toml file.

    • brettvitaz@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      1 year ago

      Agreed. Except that it’s not easier to write imo

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

        The very first moment that I had to use JSON as a configuration format, and I was desperate to find a way to make a long string into a JSON field. JSON is great for many things, but it’s not good at all for a configuration format where you need users to make it pretty, and need features like comments or multi-line strings (because you don’t want to fix a merge conflict in a 400 character-wide line).

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

        Where do you put your comments in JSON files?

        • brettvitaz@programming.dev
          link
          fedilink
          English
          arrow-up
          0
          ·
          1 year ago

          For settings files I always have an example file with sensible values filled in and along with descriptive keys that serves as reasonable documentation. If something is truly unknowable, I’ve probably done something wrong.

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

            How would you mark a flag in your json settings file as deprecated?

        • Quetzalcutlass@lemmy.world
          link
          fedilink
          English
          arrow-up
          0
          ·
          edit-2
          1 year ago

          I’ve seen them included as part of the data.

          "//": "Comment goes here",

          Example here.

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

            That doesn’t really work when you need two comments at the same level, since they’d both have the same key

            • vrighter@discuss.tchncs.de
              cake
              link
              fedilink
              arrow-up
              0
              ·
              1 year ago

              write json with comments. Use a yaml parser.

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

                If you’re reaching for yaml, why not use toml?

                • vrighter@discuss.tchncs.de
                  cake
                  link
                  fedilink
                  arrow-up
                  0
                  ·
                  1 year ago

                  because of the cut and paste problem. It works in json.

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

                    Cut and paste problem?

            • catfish@lemmy.ml
              link
              fedilink
              arrow-up
              0
              ·
              1 year ago

              It still works since multiple identical keys are still valid json. Although that in itself isn’t fantastic imo.

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programming@programming.dev

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 45 users / day
  • 940 users / week
  • 3.1K users / month
  • 7.51K users / 6 months
  • 1 local subscriber
  • 21.3K subscribers
  • 1.56K Posts
  • 20.7K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • MaungaHikoi@lemmy.nz
  • UlrikHD@programming.dev
  • BE: 0.19.8
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org