{"id":31965082,"url":"https://github.com/jliocsar/jstr","last_synced_at":"2026-03-07T00:32:23.655Z","repository":{"id":190088041,"uuid":"681880636","full_name":"jliocsar/jstr","owner":"jliocsar","description":"🃏 Simple JavaScript CLI tool to read and parse JSON files.","archived":false,"fork":false,"pushed_at":"2025-12-26T22:09:11.000Z","size":636,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-18T10:40:22.867Z","etag":null,"topics":["cli","javascript","json","manipulation","object","parsing","terminal","ts-belt","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/jliocsar.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","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":"2023-08-23T00:58:39.000Z","updated_at":"2025-08-14T09:32:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"7958ee27-8ec6-455a-9496-e6de4c9c9d2d","html_url":"https://github.com/jliocsar/jstr","commit_stats":null,"previous_names":["jliocsar/jstr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jliocsar/jstr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jliocsar%2Fjstr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jliocsar%2Fjstr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jliocsar%2Fjstr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jliocsar%2Fjstr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jliocsar","download_url":"https://codeload.github.com/jliocsar/jstr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jliocsar%2Fjstr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["cli","javascript","json","manipulation","object","parsing","terminal","ts-belt","typescript"],"created_at":"2025-10-14T17:40:38.346Z","updated_at":"2026-03-07T00:32:23.641Z","avatar_url":"https://github.com/jliocsar.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/jliocsar"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=center\u003e\n\n\u003cimg src=https://i.imgur.com/LIN9cMA.png width=140 /\u003e\n\n# jstr\n\n[![Documentation](https://img.shields.io/badge/docs-EAE8E9?logo=gitbook\u0026logoColor=2A252B\u0026style=flat-square)](https://jliocsar.gitbook.io/jstr)\n[![JavaScript](https://img.shields.io/badge/javascript-100%25-EAE8E9?logo=javascript\u0026style=flat-square\u0026labelColor=2A252B)](#)\n[![Package size](https://img.shields.io/npm/v/%40jliocsar/jstr?logo=npm\u0026style=flat-square\u0026color=EAE8E9\u0026labelColor=2A252B)](https://www.npmjs.com/package/@jliocsar/jstr)\n\n_Simple JavaScript CLI tool to read and parse JSON files_\n\n\u003c/div\u003e\n\n- 🪶 **Lightweight**: Tiny as f*ck, keeping it simple \u0026 straightforward;\n- ⚡ **Fast**: Get parsed results or new JSON files in milliseconds;\n- 🦣 **Functional**: Have the benefits of functional programming in your JSON parsing tool (see [`ts-belt`](https://mobily.github.io/ts-belt/));\n- 🙅 **No BS**: Manipulate results with good ole' JavaScript, no need to learn cryptic languages/libraries -- use what fits you best.\n- 🌭 **Multi-platform**: Runs anywhere -- Linux, macOS \u0026 Windows; Read data from your clipboard, file or I/O.\n\n## Description\n\n**JS**ON S**tr**ingifier (`jstr`, pronounced as _jester_) is a CLI tool built with JavaScript \u0026 [`ts-belt`](https://mobily.github.io/ts-belt/) to easily parse and manipulate JSON strings or files.\n\nIt is a `JSON.parse`/`stringify` wrapper focused in CLI commands rather than JS scripts.\n\n[![BuyMeACoffee](https://www.buymeacoffee.com/assets/img/custom_images/purple_img.png)](https://www.buymeacoffee.com/jliocsar)\n\n## Requirements\n\nTo run `jstr`, you must have either [Node.js](https://nodejs.org/en/blog/release/v18.0.0) or [Bun](https://bun.sh/blog/bun-v1.0) ^v1.0.0 installed.\n\n## Installation\n\n```sh\nnpm i -g @jliocsar/jstr\n```\n\nTo make sure it installed successfully:\n\n```sh\njstr --version\n```\n\n### Bun version\n\n`jstr` also exposes a version to run with [`Bun`](https://github.com/oven-sh/bun):\n\n```sh\njstr.bun --version\n```\n\n\u003e **Note**\n\u003e\n\u003e Currently `jstr` runs faster in Node v20 against `jstr.bun` in Bun 1.0.3.\n\u003e\n\u003e Keep that in mind if you plan to use the Bun version.\n\n---\n\n## Usage\n\n### [Documentation](https://jliocsar.gitbook.io/jstr/)\n\nMake sure you read the docs! It has all the details about each command option and such.\n\n### Map field names\n\nThe `-m`/`--map` option will rename fields using dot notation (see [Notation.js](https://www.npmjs.com/package/notation))\n\n**Example:**\n\nInput (`./package.json` file):\n\n```json\n{ \"name\": \"Test\", \"devDependencies\": { \"pkg\": \"1.0.0\" } }\n```\n\n```sh\njstr -s 2 -m '{\"devDependencies.pkg\":\"devDependencies.foo\"}' --prefix \"bar:\" package.json\n```\n\nOutput:\n\n```json\n{\n  \"bar:name\": \"Test\",\n  \"bar:devDependencies\": { \"foo\": \"1.0.0\" }\n}\n```\n\n### Read from `stdin` (pipe commands)\n\nThe `-i`/`--input` option will read the JSON data from `stdin` rather than the file provided:\n\n**Example:**\n\nInput (Output from running `my-fetch-script.js`):\n\n```json\n{\n  \"coordinates\": {\n    \"latitude\": 20,\n    \"longitude\": 20\n  }\n}\n```\n\n```sh\nnode my-fetch-script.js | jstr -s 2 -i \\\n  -m '{\"coordinates.longitude\":\"longitude\",\"coordinates.latitude\":\"latitude\"}' \\\n  '({ latitude, longitude }) =\u003e [latitude, longitude]'\n```\n\nIf you don't want to mess around with the mapping of fields,\nyou can just use pure JS instead and skip the `-m` option`:\n\n```js\n({ coordinates: { latitude, longitude } }) =\u003e [latitude, longitude]\n```\n\n**Output:**\n\n```json\n[20, 20]\n```\n\n### Evolve JSON files\n\nYou can also use `jstr` to remake JSON files:\n\n**Example:**\n\nInput (`./package.json` file):\n\n```json\n{ \"name\": \"Test\", \"devDependencies\": { \"pkg\": \"1.0.0\" } }\n```\n\n```sh\njstr -s 2 -m '{\"devDependencies.pkg\":\"bar\"}' --prefix \"foo:\" package.json \\\n  \"x =\u003e {\n    x['foo:name'] = x['foo:name'].toUpperCase()\n    return x\n  }\" \u003e my-new-file.json\n```\n\nOutput (`./my-new-file.json` file):\n\n```json\n{\n  \"foo:name\": \"TEST\",\n  \"foo:bar\": \"1.0.0\"\n}\n```\n\n### CSV Output\n\nYou can provide the `--csv` flag to format the output to CSV:\n\n**Example:**\n\nInput (`./users.json` file):\n\n```json\n[\n  {\n    \"name\": \"Tiny\",\n    \"age\": 27,\n    \"friends\": [{ \"name\": \"Other\" }]\n  },\n  {\n    \"name\": \"Tim\",\n    \"age\": 28,\n    \"friends\": [\n      { \"name\": \"Some\" },\n      { \"name\": \"Friend\" }\n    ]\n  }\n]\n```\n\n```sh\njstr users.json --csv \"flow(A.map(D.get('friends')), A.flat)\" \u003e users.csv\n```\n\nOutput (`./users.csv` file):\n\n```csv\nname\nOther\nSome\nFriend\n```\n\n### API Usage\n\nYou can call `jstr` from your Node.js script through its API:\n\n**Example:**\n\n```js\nconst { jstr } = require('@jliocsar/jstr/api')\n\n;(async () =\u003e {\n  console.log(await jstr(\n    './my-file.json',\n    \"x =\u003e x['foo:name']\",\n    { prefix: 'foo:' }\n  ))\n})()\n```\n\n## To do\n\n- [ ] Support require of user-defined modules?;\n- [ ] Get more coffee.\n\n## Credits\n\n[Logo icon from Freepik](https://www.freepik.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjliocsar%2Fjstr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjliocsar%2Fjstr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjliocsar%2Fjstr/lists"}