{"id":16247225,"url":"https://github.com/dotnetcarpenter/validate-json","last_synced_at":"2025-03-19T19:31:15.463Z","repository":{"id":57390122,"uuid":"76214717","full_name":"dotnetCarpenter/validate-json","owner":"dotnetCarpenter","description":"Simple cli to validate any JSON","archived":false,"fork":false,"pushed_at":"2020-04-14T04:29:55.000Z","size":87,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-26T17:21:45.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/valid-json-cli","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/dotnetCarpenter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-12-12T02:21:07.000Z","updated_at":"2023-10-27T22:49:04.000Z","dependencies_parsed_at":"2022-09-19T03:02:42.240Z","dependency_job_id":null,"html_url":"https://github.com/dotnetCarpenter/validate-json","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetCarpenter%2Fvalidate-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetCarpenter%2Fvalidate-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetCarpenter%2Fvalidate-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetCarpenter%2Fvalidate-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotnetCarpenter","download_url":"https://codeload.github.com/dotnetCarpenter/validate-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244492901,"owners_count":20461578,"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-10-10T14:36:22.284Z","updated_at":"2025-03-19T19:31:15.120Z","avatar_url":"https://github.com/dotnetCarpenter.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"validjson\n=========\n[![Build Status Linux](https://travis-ci.org/dotnetCarpenter/validate-json.svg?branch=master)](https://travis-ci.org/dotnetCarpenter/validate-json)\n[![Buld Status Windows](https://ci.appveyor.com/api/projects/status/mvp3262p1qwj2hlx/branch/master?svg=true)](https://ci.appveyor.com/project/dotnetCarpenter/validate-json/)\n\n\nSimpel command line JSON validator with an API. Support nodejs \u003e=7.0.0.\n\nTested to work in Windows PowerShell and *nix bash terminal.\n\n\n### Installation ###\n\n```\nnpm i -g valid-json-cli\n```\n\n\n### Usage ###\n\n```\nUsage:  validjson path [options]\n        cat file.json | validjson [options]\n        validjson [options] \u003c file.json\n\nOptions:\n      -s, --silent     no text output - will still exit with exitcode 0 or 1\n      -v, --version    display version number and exit\n      -h, --help       display this help and exit\n```\n\nCurrently the only option which does something is `--silent`, which supresses error hint\non error. It does not matter if you set the option before or after the path if you\nsupply a file as parameter. Unknown parameters are ignored.\n\nThe difference between `validjson file.json` and `validjson \u003c file.json` is that\nin the former, nodejs fs is reading the file and\nin the latter, your terminal (e.i. bash etc) is reading the file and streaming it to validjson.\n\n\n![displays errors in color on the command line](img/Screenshot_from_version_1.1.1.png \"Graphical error hint\")\n_Graphical error hint_\n\n### API ###\n\n`validjson({String} json, {Boolean} [silent]) : {Boolean} valid`\n\n+ json - the input you want to validate as JSON\n+ silent - an optional option to silent validjson on error - defaults to false\n\n\n```js\n\"use strict\"\n// API: validjson({String} json, {Boolean} [silent]) : {Boolean} valid\nconst validjson = require(\"valid-json-cli\")\nconst http = require(\"http\")\nconst request = http.request({ hostname: \"jsonip.com\" }, response =\u003e {\n    let json = \"\"\n    response.setEncoding(\"utf8\");\n    response.on(\"data\", (chunk) =\u003e {\n        json += chunk\n    })\n    response.on(\"end\", () =\u003e {\n        console.log(`JSON data is ${validjson(json, true) ? \"valid\" : \"invalid\"}`)\n        console.log(json)\n    })\n})\n\nrequest.end()\n```\nLive example: https://runkit.com/585114841ca9e00014bc0cb4/585114841ca9e00014bc0cb5\n\n### Installation and usage within a project ###\n\n```\nnpm i --save valid-json-cli\nyarn add valid-json-cli\n```\n_npm and yarn example_\n\nIn your `package.json` you can add:\n\n```json\n\"scripts\": {\n    \"validjson\": \"validjson\",\n    \"json\": \"validjson \u003c file.json \u0026\u0026 echo Good to go!\"\n},\n```\n\nNow you can use it via `npm run validjson` from outside npm e.i. Make.\n\n```make\nfile.js : file1.json\n    npm run validjson -- --silent $\u003c\n    # do something more\n```\n_Make example_\n\n### License ###\n\nThe MIT License (MIT)\n\nCopyright © 2016 Jon Ege Ronnenberg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnetcarpenter%2Fvalidate-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotnetcarpenter%2Fvalidate-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnetcarpenter%2Fvalidate-json/lists"}