{"id":22200405,"url":"https://github.com/iaseth/josn","last_synced_at":"2025-07-27T02:33:21.078Z","repository":{"id":153493996,"uuid":"629557160","full_name":"iaseth/josn","owner":"iaseth","description":"Josn is a command-line JSON viewer.","archived":false,"fork":false,"pushed_at":"2023-05-15T08:01:16.000Z","size":580,"stargazers_count":62,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-01T05:03:18.983Z","etag":null,"topics":["cli","command-line","command-line-tool","json","json5","nodejs"],"latest_commit_sha":null,"homepage":"https://josn.js.org/","language":"TypeScript","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/iaseth.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-04-18T14:51:19.000Z","updated_at":"2024-01-23T17:47:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5997e14-2118-4745-903e-7711e470a0e9","html_url":"https://github.com/iaseth/josn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fjosn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fjosn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fjosn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fjosn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iaseth","download_url":"https://codeload.github.com/iaseth/josn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227752474,"owners_count":17814511,"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":["cli","command-line","command-line-tool","json","json5","nodejs"],"created_at":"2024-12-02T15:26:35.684Z","updated_at":"2024-12-02T15:26:40.458Z","avatar_url":"https://github.com/iaseth.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# josn\n[`josn-cli`](https://www.npmjs.com/package/josn-cli) is a command-line `JSON` viewer, written in `JavaScript` and `TypeScript`.\n\nI felt the need for a JSON browser when I was working on [`iaseth/top-100-yc-companies`](https://github.com/iaseth/top-100-yc-companies).\nI primarily use it to verify the JSON data collected in my web scraping projects.\nI have created a similar tool ([`jsonplus`](https://github.com/iaseth/jsonplus)) in `C++`,\nwhich is a lot more limited in functionality.\n\nFour of my other projects, [`josnlib`](https://github.com/iaseth/josnlib), [`whichtype`](https://github.com/iaseth/whichtype),\n[`jslice`](https://github.com/iaseth/jslice) and [`jtransform`](https://github.com/iaseth/jtransform),\nactually started out as modules within `josn`,\nbut were later made separate packages to allow for easier testing and code reuse.\n\nI am using [`readmix`](https://github.com/iaseth/readmix) for generating this README.\nYou can view the source file [here](https://github.com/iaseth/josn/blob/master/README.md.rx).\n\n\n## Table of contents\n* [josn](#josn)\n    * [Table of contents](#table-of-contents)\n    * [Installation](#installation)\n    * [Updating JOSN](#updating-josn)\n    * [Usage](#usage)\n    * [Demos](#demos)\n    * [List of flags](#list-of-flags)\n    * [Package details](#package-details)\n    * [Dependencies](#dependencies)\n    * [Dev dependencies](#dev-dependencies)\n    * [License](#license)\n\n\n## Installation\nYou can install [`josn-cli`](https://www.npmjs.com/package/josn-cli) with the following command:\n```\nnpm i -g josn-cli\n```\nNow you should be able to run the `josn` command in your terminal.\n\n\n## Updating JOSN\nYou can update `josn` with the following command:\n```\nnpm i -g josn-cli@latest\n```\n\n\n## Usage\n* **Printing whole files**\n\n    Provide the `filepath` as the first argument.\n    * This will print the whole file as indented JSON:\n        ```\n        josn filename.json\n        ```\n    * When you supply a `path` that is a directory, `josn` will automatically select the `package.json` inside that directory:\n        ```\n        josn reactapp\n        ```\n        This is equivalent to writing:\n        ```\n        josn reactapp/package.json\n        ```\n    * When you supply a `path` that is a directory but it does not contain a `package.json`, `josn` will try to find a `json` file in that directory:\n        ```\n        josn mydata/\n        ```\n        If the directory contains a single `JSON` file, then `josn` will select it.\n        Otherwise, it will list all the `JSON` files in that directory.\n\n* **Printing an object**\n\n    You can use the `keyName` to traverse inside an object.\n    * This will print the `dependencies` object inside `package.json`:\n        ```\n        josn package.json dependencies\n        ```\n    * `josn` is case insensitive, so you might as well write this:\n        ```\n        josn package.json Dependencies\n        ```\n    * Or even this:\n        ```\n        josn package.json DEPENDENCIES\n        ```\n    * And you can skip parts of the key name if it is unique enough:\n        ```\n        josn package.json dep\n        ```\n        This will print the first `key` that starts with the prefix `dep`.\n    * You can use a `colonArg` for selecting just the `keys` or `values` in an object:\n        ```\n        josn package.json dependencies :keys\n        ```\n        ```\n        josn package.json dependencies :values\n        ```\n        Both, `:keys` and `:values` have a shorthand syntax:\n        ```\n        josn package.json dependencies :k\n        ```\n        ```\n        josn package.json dependencies :v\n        ```\n\n* **Printing an array element**\n\n    You can use numbers to select array elements.\n    * This will print the first element of the data array:\n        ```\n        josn data.json data 0\n        ```\n    * You can also use negative indexes to select an element from the end:\n        ```\n        josn data.json data -1\n        ```\n        This will print last element of `data` array.\n    * You can use a `colonArg` for selecting just the `even` or `odd` elements in an Array:\n        ```\n        josn data.json data :even\n        ```\n        ```\n        josn data.json data :odd\n        ```\n        Keep in mind that array indexes start at 0, so `:even` will select elements at `0, 2, 4, etc` and vice-versa.\n    * You can use a `colonArg` for slicing an Array:\n        ```\n        josn data.json data :10         // select first 10 elements\n        ```\n        ```\n        josn data.json data -10:        // select last 10 elements\n        ```\n        ```\n        josn data.json data 2:5         // select elements from 2 to 4\n        ```\n        The slice syntax is heavily inspired by its counterpart in `Python`.\n\n\n## Demos\n`JOSN` comes with a bunch of demo JSON files to get you started.\n| Title | Name | Source | Description |\n| ----- | ---- | ------ | ----------- |\n| HTML Colors | [`colors.json`](https://github.com/iaseth/josn/tree/master/demojsons/colors.json) | [`iaseth/html-color-names`](https://github.com/iaseth/html-color-names) |  |\n| HTML Color Palettes | [`colorpalettes.json`](https://github.com/iaseth/josn/tree/master/demojsons/colorpalettes.json) | [`iaseth/html-color-names`](https://github.com/iaseth/html-color-names) |  |\n| YC Company Data | [`yc-companies.json`](https://github.com/iaseth/josn/tree/master/demojsons/yc-companies.json) | [`iaseth/top-100-yc-companies`](https://github.com/iaseth/top-100-yc-companies) |  |\n| YC Color Palettes | [`yc-palettes.json`](https://github.com/iaseth/josn/tree/master/demojsons/yc-palettes.json) | [`iaseth/top-100-yc-companies`](https://github.com/iaseth/top-100-yc-companies) |  |\n| YC Tailwind Colors | [`yc-tailwind.json`](https://github.com/iaseth/josn/tree/master/demojsons/yc-tailwind.json) | [`iaseth/top-100-yc-companies`](https://github.com/iaseth/top-100-yc-companies) |  |\n| Big Tech Market Cap Data | [`bigtech-market-cap.json`](https://github.com/iaseth/josn/tree/master/demojsons/bigtech-market-cap.json) | [`iaseth/bigtech-json-data`](https://github.com/iaseth/bigtech-json-data) |  |\n\nUse the following command to view the list of available demo JSON files in your `josn` installation:\n```\njosn --print-demos\n```\nYou can open a demo file with the `@demoname` syntax:\n```\njosn @colors.json colors :10 --table\n```\nYou can omit the extension `.json` for demos:\n```\njosn @colors colors :10 --table\n```\n\n\n## List of flags\n| Short | Long | Description | Status |\n| ----- | ---- | ----------- | ------ |\n| -c | --console | Use console.log() for printing selected object. | \u0026check; |\n| -d | --dir | Use console.dir() for printing selected object. | \u0026check; |\n| -D | --debug | Turns debug mode ON. | \u0026cross; |\n| -E | --exact | Turns exact mode ON. | \u0026cross; |\n| -F | --force | Force update files. | \u0026cross; |\n| -g | --green | Green is for the environment. | \u0026cross; |\n| -h | --help | Show help. | \u0026check; |\n| -i | --ignore-case | Ignore case (default). | \u0026cross; |\n|  | --license | Print the LICENSE. | \u0026cross; |\n| -l | --list | List all input files. | \u0026cross; |\n| -m | --minify | Minify the output. | \u0026check; |\n| -n | --no-ignore-case | Do not ignore case. | \u0026cross; |\n| -p | --plaintext | Output plaintext. | \u0026cross; |\n|  | --print-args | Just print the arguments. | \u0026check; |\n|  | --print-demos | Just print the demos. | \u0026check; |\n|  | --print-flags | Just print the flags. | \u0026check; |\n| -q | --quiet | Turns quiet mode ON. | \u0026cross; |\n|  | --repl | Opens the REPL. | \u0026cross; |\n| -s | --spaces2 | Indent with 2 spaces. | \u0026check; |\n| -S | --spaces4 | Indent with 4 spaces. | \u0026check; |\n| -t | --table | Print output as a table. | \u0026check; |\n| -T | --tabs | Indent with Tabs. | \u0026check; |\n| -v | --version | Print version. | \u0026check; |\n| -w | --watch | Watch input files for changes. | \u0026cross; |\n| -x | --experimental | Turns experimental mode ON. | \u0026cross; |\n| -Z | --zen | Turns zen mode ON. | \u0026cross; |\n\n\n## Package details\n| `Name`         | `Value`                               |\n| -------------- | ------------------------------------- |\n| `Name`         | `josn-cli`                            |\n| `Description`  | `JOSN is a command line JSON viewer.` |\n| `Version`      | `0.34.0`                              |\n| `Author`       | `iaseth`                              |\n| `Homepage`     | `https://github.com/iaseth/josn`      |\n| `Repository`   | `iaseth/josn`                         |\n| `License`      | `MIT`                                 |\n| `Dependencies` | `1`                                   |\n\n\n\n## Dependencies\n|     | `Package`   | `Version`   |\n| --- | ----------- | ----------- |\n| 1   | `josnlib`   | `^0.18.0`   |\n\n\n\n## Dev dependencies\n|     | `Package`     | `Version`   |\n| --- | ------------- | ----------- |\n| 1   | `@types/jest` | `^29.5.1`   |\n| 2   | `jest`        | `^29.5.0`   |\n\n\n\n## License\nMIT License\n\nCopyright (c) Ankur Seth.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n## Credit\n\nThis file was generated using [`readmix`](https://github.com/iaseth/readmix).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiaseth%2Fjosn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiaseth%2Fjosn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiaseth%2Fjosn/lists"}