JSONNET(1)

🌸 JSONNET(1) 🌸

okay bestie, pull up a chair, we're talking about jsonnet β€” specifically the auto-formatter side of it, from the User Commands section of the manual. iykyk. ✨


πŸ’– NAME πŸ’–

Jsonnet β€” it's the Jsonnet data templating language's auto-formatter, and it is literally here to make your files cute and consistent. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

hiii so this is Jsonnet reformatter v0.22.0, and it's giving "i will fix your spacing and you will thank me." πŸ’…

the whole vibe is:

jsonnetfmt {<option>} { <filename> }

that's it. that's the whole ritual. 🫢


✨ Available options: ✨

  • -h / --help β€” prints this message, aka the "what do i even do here" button. iconic.
  • -e / --exec β€” treats filename as code instead of a file. not me feeding it a string straight to its face 😭
  • -o / --output-file <file> β€” writes the glow-up to file instead of to stdout. yes, we're saving it, bestie.
  • -i / --in-place β€” updates the Jsonnet file(s) right in place. no copy, no backup, just ✨direct✨. slay but be aware.
  • --test β€” exits with failure if the reformatting changed the file(s). it's literally a vibe check for your formatting. if it changes anything, it says no. πŸ’€
  • -n / --indent <n> β€” how many spaces to indent by. default is 2, and 0 means no change at all. pick your fighter.
  • --max-blank-lines <n> β€” max vertical spacing. 0 means no change, and the default is 2. stop leaving 47 blank lines in your file, i'm begging πŸ™ˆ
  • --string-style <d|s|l> β€” enforces d for double quotes, s for single quotes (this is the default), or l for 'leave'. let it be known.
  • --comment-style <h|s|l> β€” h gives you #, s gives you // (and that's the default), or l for 'leave'. heads up though, it never changes she-bang. that one's sacred. πŸ‘‘
  • --[no-]pretty-field-names β€” uses syntax sugar for fields and indexing. it's on by default.
  • --[no-]pad-arrays β€” gives you [ 1, 2, 3 ] instead of [1, 2, 3] πŸ’–
  • --[no-]pad-objects β€” gives you { x: 1, y: 2 } instead of {x: 1, y: 2}, and yes it's on by default ✨
  • --[no-]sort-imports β€” sorts your imports. on by default. your imports are getting organized whether they like it or not. 🧚
  • --debug-desugaring β€” unparses the desugared AST without executing it. it's literally just looking, not touching. no cap.
  • --version β€” prints the version. simple, powerful, main character energy. ⭐

🌈 In all cases: 🌈

  • <filename> can be - which means stdin. feeding it through a pipe? valid. we love a flexible queen. πŸ“
  • Multichar options get expanded, so e.g. -abc becomes -a -b -c. it's not one mysterious flag, it's three little ones holding hands.
  • The -- option suppresses option processing for all subsequent arguments. basically "everything after this is my child now, don't touch it."
  • > ⚠️ real talk, bestie: since filenames and jsonnet programs can begin with -, it is advised to use -- if the argument is unknown, e.g. jsonnet -- "$FILENAME". this is the single most important thing on this page and i will not be chill about it. πŸ”₯

thanks for coming to my ted talk πŸ’œ this was Jsonnet reformatter v0.22.0, brought to you from September 2026, filed under JSONNET(1). go format something gorgeous, bestie. mwah. πŸ’…πŸŽ€βœ¨

πŸ“¦ where this page comes from