jo - JSON from key value pairs

Reading discussions on creating JSON on the command line gave me the idea to create my own small tool called jo.

You can find it in my belt repository on codeberg .

If you want to install using go:

go install codeberg.org/usysrc/belt/jo@latest

It takes a number of arguments in key=value format and generates json from it.

jo user=untilde
{
  "user": "untilde"
}

It also supports nested keys.

jo "users[untilde][url]=untilde.co"
{
  "users": {
    "untilde": {
      "url": "untilde.co"
    }
  }
}

If you pipe in some pairs you’ll get a mix of both.

echo "name=untilde" | jo "url=untilde.co" "status=hungry"
{
  "name": "untilde",
  "status": "hungry",
  "url": "untilde.co"
}
Enjoyed this post or have feedback?
← On the BTS