{"id":37116254,"url":"https://github.com/lucasepe/clon","last_synced_at":"2026-01-14T13:38:12.295Z","repository":{"id":57578881,"uuid":"359832495","full_name":"lucasepe/clon","owner":"lucasepe","description":"A convenient syntax to generate JSON (or YAML) for commandline \"mumbo-jumbo\".","archived":true,"fork":false,"pushed_at":"2021-04-24T17:07:11.000Z","size":248,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-20T02:12:02.188Z","etag":null,"topics":["commandline","generators","golang","json","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucasepe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-20T13:49:07.000Z","updated_at":"2024-05-14T23:24:13.000Z","dependencies_parsed_at":"2022-09-26T19:11:05.210Z","dependency_job_id":null,"html_url":"https://github.com/lucasepe/clon","commit_stats":null,"previous_names":["lucasepe/map"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/lucasepe/clon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Fclon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Fclon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Fclon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Fclon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucasepe","download_url":"https://codeload.github.com/lucasepe/clon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Fclon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28421426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["commandline","generators","golang","json","yaml"],"created_at":"2026-01-14T13:38:11.735Z","updated_at":"2026-01-14T13:38:12.269Z","avatar_url":"https://github.com/lucasepe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clon\n\n\u003e A convenient syntax to generate JSON (or YAML) for commandline _\"mumbo-jumbo\"_.\n\n# Syntax Overview\n\nSyntax resembles that of JSON with a few caveats:\n\n- a field is a key/value pair\n- fields are separated by space (one or more)\n- curly braces hold objects\n- square brackets hold arrays\n\n## fields\n\n\u003e A field is defined by: `IDENTIFIER = VALUE` .\n\n- field key/value pairs have a equal `=` between them as in `key = value` \n- each field is separated by space (one or more does not matter)\n\n```sh\n$ clon firstName = Scarlett lastName = Johansson\n```\n\ngenerates...\n\n```json\n{\n   \"firstName\": \"Scarlett\",\n   \"lastName\": \"Johansson\"\n}\n```\n\n- values are treated as strings by default\n- other types (numbers, booleans, null) need to be prefixed with a colon `:` \n  - es. `age = :30 customer = :true`\n- to refer to an environment variable prefix the value with a `^` \n  - es. `bucket = ^S3_BUCKET`\n  - by default the `.env` file in the current folder is used, use the `-env-file` flag to change it)\n\n\n```sh\n$ clon fullName = \\\"Scarlett Johansson\\\" age = :36 hot = :true\n```\n\ngenerates...\n\n```json\n{\n   \"age\": 36,\n   \"fullName\": \"Scarlett Johansson\",\n   \"hot\": true\n}\n```\n\n## objects\n\n\u003e An object is defined by: `IDENTIFIER = { fields... }`.\n\n- begin a new object using the left curly brace `{`\n- close the object with a right curly brace `}`\n\n```sh\n$ clon user = { name=foo age=:30 active=:true address = { zip=123 country=IT } }\n```\n\ngenerates...\n\n```json\n{\n   \"user\": {\n      \"active\": true,\n      \"address\": {\n         \"country\": \"IT\",\n         \"zip\": \"123\"\n      },\n      \"age\": 30,\n      \"name\": \"foo\"\n   }\n}\n```\n\n- you can also use dotted notation (and mix things)\n\n```sh\n$ clon user = { name=foo age=:30 active=:true address.zip=123 address.country=IT }\n```\n\n```sh\n$ clon user.name=foo user.age=:30 user.active=:true user.address = {zip=123 country=IT}\n```\n\n```sh\n$ clon user.name=foo user.age=:30 user.active=:true user.address.zip=123 user.address.country=IT\n```\n\nare all examples that generate the same JSON as above; it's up to you to find your way.\n\n\n## arrays\n\n\u003e An array is defined by: `IDENTIFIER = [ fields...]`.\n\n- begin a new array using the left square brace `[`\n- end the array with a right quare brace `]`\n\n```sh\n$ clon tags = [ foo bar qix ]\n```\n\n```json\n{\n   \"tags\": [\n      \"foo\",\n      \"bar\",\n      \"qix\"\n   ]\n}\n```\n\nYou can create an array of object too:\n\n```sh\n$ clon pets = [ { name=Dash kind=cat age=:3 } {name=Harley kind=dog age=:4} ]\n```\n\n```json\n{\n   \"pets\": [\n      {\n         \"age\": 3,\n         \"kind\": \"cat\",\n         \"name\": \"Dash\"\n      },\n      {\n         \"age\": 4,\n         \"kind\": \"dog\",\n         \"name\": \"Harley\"\n      }\n   ]\n}\n```\n\n# Usage\n\n```bash\n$ clon user = { name=foo age=:30 type=C address.zip=123 address.country=Italy }\n```\n\ngenerates...\n\n```json\n{\n   \"user\": {\n      \"address\": {\n         \"country\": \"Italy\",\n         \"zip\": \"123\"\n      },\n      \"age\": 30,\n      \"name\": \"foo\",\n      \"type\": \"C\"\n   }\n}\n```\n\n## Use Cases ?\n\n### Create `JSON` payload and POST it with `cURL`\n\n```sh\n$ clon user = { name=Pinco age=:30 address = { zip=123 country=CA } } \\\n  | curl -H \"Content-Type: application/json\" \\\n         -X POST --data-binary @- \\\n         https://httpbin.org/anything\n```\n\n### Elasticsearch query string query\n\n```sh\n$ clon query.query_string.query = \\\"new york city\\\" \\\n  | curl -H \"Content-Type: application/json\" \\\n         --data-binary @- http://localhost:9200/_search\n```\n\n# How to install?\n\nIn order to use the `map` command, compile it using the following command:\n\n```bash\ngo get -u github.com/lucasepe/map\n```\n\nThis will create the executable under your `$GOPATH/bin` directory.\n\n## Ready-To-Use Releases \n\nIf you don't want to compile the sourcecode yourself, [Here you can find the tool already compiled](https://github.com/lucasepe/map/releases/latest) for:\n\n- MacOS\n- Linux\n- Windows\n\n\n\u003cbr/\u003e\n\n### Credits\n\nThanks to [@jawher](https://github.com/jawher) for the amazing [jg](https://github.com/jawher/jg) idea and original implementation - this is a modified fork.\n\nWhat I changed? \n\n- lexer and parser now can resolve attribute values ​​from environment variables\n- dotenv files support\n- additional YAML format encoding\n- go modules support\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasepe%2Fclon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucasepe%2Fclon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasepe%2Fclon/lists"}