"Leading Comma JSON Formatter"
0

Configure Feed

Select the types of activity you want to include in your feed.

5 1 0

Clone this repository

https://tangled.org/dneaves.com/lcjf https://tangled.org/did:plc:ibkkkfto5uzr24xjm6vevnc7
git@knot.dneaves.com:dneaves.com/lcjf git@knot.dneaves.com:did:plc:ibkkkfto5uzr24xjm6vevnc7

For self-hosted knots, clone URLs may differ based on your setup.



README.md

lcjf#

"Leading-Comma JSON Formatter"

Why#

Leading commas are the superior way to format JSON, dictionaries, records, etc. You either know it or are in denial of it.

This simple little program lets you input JSON via stdin or a pipe, then it spits out properly-formatted JSON with leading commas. The right way.

It turns this (from jq):

{
  "api_version": "2.1.0",
  "debug": null,
  "features": {
    "beta": [
      "new_fancy_thing"
    ],
    "deprecated": {},
    "stable": []
  },
  "users": [
    {
      "active": false,
      "email": "bob@example.com",
      "id": 1,
      "metadata": {
        "created_at": "2024-06-22T14:45:00Z",
        "last_login": "2024-11-01T09:00:00Z",
        "preferences": {
          "language": "en-US",
          "notifications": false,
          "theme": "dark"
        }
      },
      "name": "Bob Smith"
    }
  ]
}

Into this beauty:

{ "api_version": "2.1.0"
, "debug": null
, "features":
  { "beta":
    [ "new_fancy_thing"
    ]
  , "deprecated": { }
  , "stable": [ ]
  }
, "users":
  [ { "active": false
    , "email": "bob@example.com"
    , "id": 1
    , "metadata":
      { "created_at": "2024-06-22T14:45:00Z"
      , "last_login": "2024-11-01T09:00:00Z"
      , "preferences":
        { "language": "en-US"
        , "notifications": false
        , "theme": "dark"
        }
      }
    , "name": "Bob Smith"
    }
  ]
}

Much better.

Supports reading from stdin, argument-strings, or a file, and outputs to stdout or a file. All the stuff you'd expect.

Installing#

Until I push this to Hackage and actually set up pre-built binaries, best way to install and use this is to clone it and cabal install it. Make sure ~/.local/bin is on your path.

Contributing#

Honestly, I don't know how that's going to work now with my own Forgejo instance here. I don't even know how creating Issues works on here at the moment. Probably best to just yell at me on social media and I'll do something eventually maybe.

AI Disclaimer#

This program was put together with the work of a Claude AI agent. My opinions on AI as a whole are largely negative, and I refrain from using it for matters of creative industries. I normally only use it with software development for research assistance, minimizing its actual writing of code.

This program, however, was almost entirely made with the Claude Code AI agent. To me, this is a silly little project that is unlikely to gain usage, and I didn't care about the time to write an program for Aeson parsing followed by pretty printing.