{"id":23535035,"url":"https://github.com/ripta/mj","last_synced_at":"2025-11-01T00:30:27.760Z","repository":{"id":57491342,"uuid":"58905392","full_name":"ripta/mj","owner":"ripta","description":"Make JSON from the command line…","archived":false,"fork":false,"pushed_at":"2025-01-24T10:06:26.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-16T09:43:06.531Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ripta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-16T05:12:45.000Z","updated_at":"2025-01-24T10:06:34.000Z","dependencies_parsed_at":"2024-06-20T08:20:43.120Z","dependency_job_id":"de0fd5a7-1f62-4eba-b9f7-74dc346f41ee","html_url":"https://github.com/ripta/mj","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ripta%2Fmj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ripta%2Fmj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ripta%2Fmj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ripta%2Fmj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ripta","download_url":"https://codeload.github.com/ripta/mj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239242112,"owners_count":19605954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-26T01:14:28.037Z","updated_at":"2025-11-01T00:30:27.725Z","avatar_url":"https://github.com/ripta.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MJ\n\n`Make JSON` from the command line.\n\nThe program takes a list of key=value parameter on the command line:\n\n```shell\n$ mj foo=bar\n{\"foo\":\"bar\"}\n\n$ mj foo=bar baz=quux\n{\"baz\":\"quux\",\"foo\":\"bar\"}\n```\n\nThe only requirement being that the keys be unique:\n\n```shell\n$ mj a=b a=c\nError: Key path was already assigned\n```\n\nA key can be a simple string, or a .-separated path of arbitrary depth:\n\n```shell\n$ mj foo.bar=baz\n{\"foo\":{\"bar\":\"baz\"}}\n```\n\nThere are command-line options to select a different separator for key-value\npairs and for key paths:\n\n```shell\n$ mj foo:bar=baz\n{\"foo:bar\":\"baz\"}\n\n$ mj -s=: foo:bar=baz\n{\"foo\":\"bar=baz\"}\n\n$ mj -p=: foo:bar=baz\n{\"foo\":{\"bar\":\"baz\"}}\n\n$ mj -p='-\u003e' 'foo-\u003ebar=baz'\n{\"foo\":{\"bar\":\"baz\"}}\n```\n\nIf a key starts with `-`, it will be interpreted as a command line flag. To\nprevent that, use `--`:\n\n```shell\n$ mj -really=why\nError: flag provided but not defined: -really\n\n$ mj -- -really=why\n{\"-really\":\"why\"}\n```\n\nThere is also support for slices on the last level:\n\n```shell\n$ mj foo[]=abc foo[]=def\n{\"foo\":[\"abc\",\"def\"]}\n```\n\nBut the operation is not supported on deeply-nested objects yet:\n\n```shell\n$ mj foo[].bar=abc foo[].bar=def\nmj: encountered error while processing argument #0: \"foo[].bar=abc\"\n\tunderlying error: while processing key path [foo[] bar]: cannot set key \"bar\" to \"abc\" on []interface {}: not supported\n```\n\nBy default, values are interpreted as-is:\n\n```shell\n$ mj foo=@bar.txt\n{\"foo\":\"@bar.txt\"}\n```\n\nHowever, you can designate certain prefixes to read values from a file:\n\n```shell\n$ echo hello-world \u003e bar.txt\n$ mj -r=@ foo=@bar.txt\n{\"foo\":\"hello-world\\n\"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fripta%2Fmj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fripta%2Fmj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fripta%2Fmj/lists"}