{"id":13588835,"url":"https://github.com/hannupekka/jsonni-cli","last_synced_at":"2025-04-08T06:32:52.094Z","repository":{"id":34416932,"uuid":"178911524","full_name":"hannupekka/jsonni-cli","owner":"hannupekka","description":"Transform data on command line","archived":false,"fork":false,"pushed_at":"2023-01-03T18:55:03.000Z","size":2124,"stargazers_count":14,"open_issues_count":14,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-13T13:06:29.918Z","etag":null,"topics":["csv","fromfrom","javascript","json","lodash","transformation","tsv"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/hannupekka.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}},"created_at":"2019-04-01T17:18:02.000Z","updated_at":"2023-12-05T06:25:09.000Z","dependencies_parsed_at":"2023-01-15T06:58:34.628Z","dependency_job_id":null,"html_url":"https://github.com/hannupekka/jsonni-cli","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/hannupekka%2Fjsonni-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannupekka%2Fjsonni-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannupekka%2Fjsonni-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannupekka%2Fjsonni-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hannupekka","download_url":"https://codeload.github.com/hannupekka/jsonni-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247792203,"owners_count":20996879,"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":["csv","fromfrom","javascript","json","lodash","transformation","tsv"],"created_at":"2024-08-01T15:06:58.158Z","updated_at":"2025-04-08T06:32:47.078Z","avatar_url":"https://github.com/hannupekka.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# ![JSONNI](https://github.com/hannupekka/jsonni/blob/master/resources/icons/64x64.png?raw=true) JSONNI\n\n[![Sponsored](https://img.shields.io/badge/chilicorn-sponsored-brightgreen.svg?logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAA4AAAAPCAMAAADjyg5GAAABqlBMVEUAAAAzmTM3pEn%2FSTGhVSY4ZD43STdOXk5lSGAyhz41iz8xkz2HUCWFFhTFFRUzZDvbIB00Zzoyfj9zlHY0ZzmMfY0ydT0zjj92l3qjeR3dNSkoZp4ykEAzjT8ylUBlgj0yiT0ymECkwKjWqAyjuqcghpUykD%2BUQCKoQyAHb%2BgylkAyl0EynkEzmkA0mUA3mj86oUg7oUo8n0k%2FS%2Bw%2Fo0xBnE5BpU9Br0ZKo1ZLmFZOjEhesGljuzllqW50tH14aS14qm17mX9%2Bx4GAgUCEx02JySqOvpSXvI%2BYvp2orqmpzeGrQh%2Bsr6yssa2ttK6v0bKxMBy01bm4zLu5yry7yb29x77BzMPCxsLEzMXFxsXGx8fI3PLJ08vKysrKy8rL2s3MzczOH8LR0dHW19bX19fZ2dna2trc3Nzd3d3d3t3f39%2FgtZTg4ODi4uLj4%2BPlGxLl5eXm5ubnRzPn5%2Bfo6Ojp6enqfmzq6urr6%2Bvt7e3t7u3uDwvugwbu7u7v6Obv8fDz8%2FP09PT2igP29vb4%2BPj6y376%2Bu%2F7%2Bfv9%2Ff39%2Fv3%2BkAH%2FAwf%2FtwD%2F9wCyh1KfAAAAKXRSTlMABQ4VGykqLjVCTVNgdXuHj5Kaq62vt77ExNPX2%2Bju8vX6%2Bvr7%2FP7%2B%2FiiUMfUAAADTSURBVAjXBcFRTsIwHAfgX%2FtvOyjdYDUsRkFjTIwkPvjiOTyX9%2FAIJt7BF570BopEdHOOstHS%2BX0s439RGwnfuB5gSFOZAgDqjQOBivtGkCc7j%2B2e8XNzefWSu%2BsZUD1QfoTq0y6mZsUSvIkRoGYnHu6Yc63pDCjiSNE2kYLdCUAWVmK4zsxzO%2BQQFxNs5b479NHXopkbWX9U3PAwWAVSY%2FpZf1udQ7rfUpQ1CzurDPpwo16Ff2cMWjuFHX9qCV0Y0Ok4Jvh63IABUNnktl%2B6sgP%2BARIxSrT%2FMhLlAAAAAElFTkSuQmCC)](http://spiceprogram.org/oss-sponsorship)\n\nManipulate data with ES6, [Lodash](https://lodash.com/) or [fromfrom](https://github.com/tomi/fromfrom), on command line.\n\nCommand line version of [JSONNI](https://github.com/hannupekka/jsonni)\n\n## Install\n\n`npm install -g jsonni-cli`\n\n## Features\n\n- Reads data from `stdin`\n- Supports different syntaxes for querying data\n  - ES\n  - Lodash\n  - fromfrom\n- Supports multiple output formats\n  - JSON\n  - CSV\n  - TSV\n- Customizable output indentation\n- Optionally minimized output JSON\n\n## Usage\n\n```\nUsage: jsonni [options]\n\nOptions:\n  -v, --version                   output the version number\n  -m --minify                     minify output\n  -q --query \u003cquery\u003e              query to transform data with\n  --input \u003cformat\u003e                input format. Available formats: json, tsv, csv\n  --input-header \u003cheader\u003e         input CSV/TSV headers. Separated with \",\"\n  --input-delimiter \u003cdelimiter\u003e   CSV/TSV input delimiter character. Defaults to \",\"\n  --output \u003cformat\u003e               output format. Available formats: json, tsv, csv\n  --output-delimiter \u003cdelimiter\u003e  CSV/TSV output delimiter character. Defaults to \",\"\n  --indent \u003cindent\u003e               output indentation, defaults to \"  \"\n  -h, --help                      output usage information\n```\n\n### About `-q` parameter\n\nParameter value should be quoted with single quotes (`'`) instead of double (`\"`).\n\n## Examples\n\n```\ncurl --silent http://jsonplaceholder.typicode.com/todos?_limit=5 | jsonni\n```\n\n![default.png](./screenshots/default.png)\n\n### Grab first item\n\n```\ncurl --silent http://jsonplaceholder.typicode.com/todos?_limit=5 | jsonni -q '$input[0]'\n```\n\n![json_es_first.png](./screenshots/json_es_first.png)\n\n### Filter\n\n```\ncurl --silent http://jsonplaceholder.typicode.com/todos?_limit=5 | jsonni -q '$input.filter(item =\u003e item.completed)'\n```\n\n![json_es_filter.png](./screenshots/json_es_filter.png)\n\n### Lodash, with chain\n\n```\ncurl --silent http://jsonplaceholder.typicode.com/todos?_limit=5 | jsonni -q '_.chain($input).orderBy([\"title\"], [\"asc\"]).map(\"title\")'\n```\n\n![json_lodash_chain.png](./screenshots/json_lodash_chain.png)\n\n### Lodash, without chain\n\n```\ncurl --silent http://jsonplaceholder.typicode.com/todos?_limit=5 | jsonni -q '_.map(_.orderBy($input, [\"title\"], [\"asc\"]), \"title\")'\n```\n\n![json_lodash.png](./screenshots/json_lodash.png)\n\n### fromfrom\n\n```\ncurl --silent http://jsonplaceholder.typicode.com/todos?_limit=5 | jsonni -q 'from($input).filter(item =\u003e item.title.startsWith(\"fugiat\")).toArray()'\n```\n\n![fromfrom.png](./screenshots/fromfrom.png)\n\n### JSON, with custom indentation\n\n```\ncurl --silent http://jsonplaceholder.typicode.com/todos?_limit=5 | jsonni -q '$input[0]' --indent=\"\\t\"\n```\n\n![json_custom_indent.png](./screenshots/json_custom_indent.png)\n\n### JSON to CSV\n\n```\ncurl --silent http://jsonplaceholder.typicode.com/todos?_limit=5 | jsonni -q '$input[0]' --output=csv --output-delimiter=\";\"\n```\n\n![json_to_csv.png](./screenshots/json_to_csv.png)\n\n### JSON to TSV\n\n```\ncurl --silent http://jsonplaceholder.typicode.com/todos?_limit=5 | jsonni -q '$input[0]' --output=tsv\n```\n\n![json_to_tsv.png](./screenshots/json_to_tsv.png)\n\n### CSV to JSON\n\n```\ncat csv.csv | jsonni -q '$input[0]' --input=csv\n```\n\n![csv_to_json.png](./screenshots/csv_to_json.png)\n\n### CSV to CSV\n\n```\ncat csv.csv | jsonni -q '$input.filter(user =\u003e user.isActive)' --input=csv --output=csv\n```\n\n![csv_to_csv.png](./screenshots/csv_to_csv.png)\n\n### CSV to TSV\n\n```\ncat csv.csv | jsonni -q '$input.filter(user =\u003e user.isActive)' --input=csv --output=tsv\n```\n\n![csv_to_tsv.png](./screenshots/csv_to_tsv.png)\n\n### CSV without headers\n\n```\ncat csvWithoutHeaders.csv | jsonni -q '$input[0]' --input=csv --input-header=id,isActive,age,name,registered\n```\n\n![csv_without_headers.png](./screenshots/csv_without_headers.png)\n\n## Acknowledgements\n\nThis project is a grateful recipient of the [Futurice Open Source sponsorship program](http://futurice.com/blog/sponsoring-free-time-open-source-activities).\n\nIcon made by [Freepik](https://www.flaticon.com/authors/freepik) from [www.flaticon.com](https://www.flaticon.com)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhannupekka%2Fjsonni-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhannupekka%2Fjsonni-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhannupekka%2Fjsonni-cli/lists"}