{"id":15421799,"url":"https://github.com/chwarr/dnjc","last_synced_at":"2026-05-08T05:03:26.841Z","repository":{"id":90565314,"uuid":"263568750","full_name":"chwarr/dnjc","owner":"chwarr","description":".NET JSON Check, dnjc, is a command line tool to check for JSON syntax errors using the System.Text.Json parsers.","archived":false,"fork":false,"pushed_at":"2024-09-03T21:09:03.000Z","size":108,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T05:25:42.241Z","etag":null,"topics":["dotnet","dotnet-core","emacs","flycheck","json"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chwarr.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,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-13T08:21:10.000Z","updated_at":"2020-05-29T09:28:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"eaa70ffe-de52-4bf9-beb1-e2119ac92d43","html_url":"https://github.com/chwarr/dnjc","commit_stats":{"total_commits":32,"total_committers":1,"mean_commits":32.0,"dds":0.0,"last_synced_commit":"bf476c7f681aa0c3919ec7217ac6d20b644e16b1"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chwarr%2Fdnjc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chwarr%2Fdnjc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chwarr%2Fdnjc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chwarr%2Fdnjc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chwarr","download_url":"https://codeload.github.com/chwarr/dnjc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245968709,"owners_count":20702114,"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":["dotnet","dotnet-core","emacs","flycheck","json"],"created_at":"2024-10-01T17:35:53.704Z","updated_at":"2025-10-17T18:43:29.667Z","avatar_url":"https://github.com/chwarr.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dnjc, .NET JSON Check\n\n[.NET JSON Check][dnjc], `dnjc`, is a command line tool to check for JSON\nsyntax errors using the [`System.Text.Json`][stj] parsers.\n\n```powershell\nPS\u003e Get-Content \"good.json\" | dnjc\n# Nothing wrong: no output\nPS\u003e Get-Content \"bad.json\" | dnjc\n6\t2\t\t'}' is an invalid start of a value.\n```\n\nThe source code [is hosted on GitHub](https://github.com/chwarr/dnjc).\n\n## Install\n\n`dnjc` can be installed as a [.NET global tool][dotnet-global-tools]:\n\n```powershell\ndotnet tool install --global DotNetJsonCheck.Tool\n```\n\nIf this is the first .NET global tool you've installed, you may need to\nrestart your shell/console for it to pick up the changes to your PATH.\n\n## Versions\n\nThe current versions of the tool and the library that powers it are shown\nbelow.\n\n| Package | Version |\n|---------|---------|\n| DotNetJsonCheck.Tool | [![DotNetJsonCheck.Tool NuGet version](https://img.shields.io/nuget/v/DotNetJsonCheck.Tool?logo=nuget\u0026style=flat-square)][nuget-dnjc-tool] |\n| DotNetJsonCheck | [![DotNetJsonCheck NuGet version](https://img.shields.io/nuget/v/DotNetJsonCheck?logo=nuget\u0026style=flat-square)][nuget-dnjc] |\n\n## Invocation\n\nAfter installing, invoke it, giving it the JSON you want to check on\nstandard input. Using PowerShell, this is something like:\n\n```powershell\nGet-Content \"input.json\" | dnjc\n```\n\nOther shells, like Bash, CMD, and Zsh can use redirection:\n\n```bash\ndnjc \u003cinput.json\n```\n\nAny errors will be written to standard out.\n\n## Options\n\nWith no switches, `dnjc` will allow `/* */` and `//` comments as well\nas trailing commas. This JSON document will be successfully parsed:\n\n```jsonc\n{\n    // System.Text.Json can parse this file.\n    \"hello\": \"world\",\n}\n```\n\nThese defaults were chosen because this is how the\n[`Microsoft.Extensions.Configuration.Json`][mecj] library invokes\n`JsonDocument.Parse()`, and those are the JSON files I'm most often editing.\n\nThis behavior can be controlled:\n\n* `--allow-comments`: allows `/* */` and `//` style comments (defaults to\n  enabled)\n* `--allow-trailing-commas`: allows trailing commas in arrays and objects\n  (defaults to enabled)\n* `--strict`: parses JSON strictly (no comments, no trailing commas)\n* `--help`: prints help and exits\n* `--version`: prints version information and exits\n\nAny number of options may be passed. They are processed in order. For\nexample, to allow comments but not trailing commas, pass `--strict\n--allow-comments` in that order.\n\n## Emacs integration\n\nThe [Emacs][emacs] package `flycheck-dnjc.el` can be used to configure a\n[Flycheck][flycheck] checker that uses `dnjc`.\n\nTo install it, [download it][flycheck-dnjc.el] and then install it with\n\u003ckbd\u003eM-x\u003c/kbd\u003e `package-install-file` \u003ckbd\u003eRET\u003c/kbd\u003e\n`/path/to/where/you/downloaded/flycheck-dnjc.el`\n\nIf you use [`use-package`][use-package] to manage your packages, add this to\nyour `.emacs` file:\n\n```elisp\n(use-package flycheck-dnjc\n  :config (setup-flycheck-dnjc))\n```\n\nIf you aren't using any package managers, make sure that\n`flycheck-dnjc` in on your load-path and add:\n\n```elisp\n(require 'flycheck-dnjc)\n(setup-flycheck-dnjc)\n```\n\n## Error reporting\n\nAny errors encountered will be written to standard out, one per line. Each\nline has the format\n\n```\nLEVEL\u003cTAB\u003eLINE\u003cTAB\u003eCOLUMN\u003cTAB\u003eMESSAGE\n```\n\n* LEVEL: the severity of the issue. Currently only \"Error\" is used.\n* LINE: the 1-based line number where the error occurred or started.\n* COLUMN: the 0-based byte offset into the line where the error occurred.\n* MESSAGE: the detailed error message.\n\nIf LINE or COLUMN cannot be determined, they will be empty.\n\nAdditional columns may be added in the future at the end. Ensure your\nparsing can handle this.\n\nThe exit code of `dnjc` will be\n\n* 0: JSON parsed successfully\n* 1: invalid arguments\n* 2: errors processing the JSON\n* 126: catastrophic failure\n\n## To Do\n\nThings that I want to do, in rough priority order\n\n1. Add option to require that the top-level value be an object, an array,\n   \u0026amp;c.\n1. Use `package-upload-file` to create a hostable package archive?\n\n## License\n\nCopyright 2020, G. Christopher Warrington\n\ndnjc is free software: you can redistribute it and/or modify it under the\nterms of the GNU Affero General Public License Version 3 as published by the\nFree Software Foundation.\n\ndnjc is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\nFOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more\ndetails.\n\nA copy of the GNU Affero General Public License Version 3 is included in the\nfile [LICENSE] at the root of the repository.\n\n[dnjc]: https://www.thebluepolicebox.com/dnjc/\n[dotnet-global-tools]: https://aka.ms/global-tools\n[emacs]: https://www.gnu.org/software/emacs/\n[flycheck-dnjc.el]: https://raw.githubusercontent.com/chwarr/dnjc/master/emacs/flycheck-dnjc.el\n[flycheck]: https://www.flycheck.org/\n[LICENSE]: https://github.com/chwarr/dnjc/blob/master/LICENSE\n[mecj]: https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.json?view=dotnet-plat-ext-3.1\n[nuget-dnjc-tool]: https://www.nuget.org/packages/DotNetJsonCheck.Tool/\n[nuget-dnjc]: https://www.nuget.org/packages/DotNetJsonCheck/\n[stj]: https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=netcore-3.1\n[use-package]: https://github.com/jwiegley/use-package\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchwarr%2Fdnjc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchwarr%2Fdnjc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchwarr%2Fdnjc/lists"}