{"id":16338967,"url":"https://github.com/phadej/relaxed-json","last_synced_at":"2025-04-09T15:05:33.345Z","repository":{"id":8038968,"uuid":"9449079","full_name":"phadej/relaxed-json","owner":"phadej","description":"Relaxed JSON is strict superset JSON, relaxing strictness of vanilla JSON","archived":false,"fork":false,"pushed_at":"2019-03-04T12:58:13.000Z","size":1333,"stargazers_count":80,"open_issues_count":9,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T15:05:25.397Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://oleg.fi/relaxed-json/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phadej.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2013-04-15T13:18:16.000Z","updated_at":"2024-11-21T20:40:12.000Z","dependencies_parsed_at":"2022-08-24T01:11:02.991Z","dependency_job_id":null,"html_url":"https://github.com/phadej/relaxed-json","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Frelaxed-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Frelaxed-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Frelaxed-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Frelaxed-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phadej","download_url":"https://codeload.github.com/phadej/relaxed-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"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-10T23:53:11.176Z","updated_at":"2025-04-09T15:05:33.326Z","avatar_url":"https://github.com/phadej.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Relaxed JSON\n\n[![Build Status](https://secure.travis-ci.org/phadej/relaxed-json.svg?branch=master)](http://travis-ci.org/phadej/relaxed-json)\n[![NPM version](https://badge.fury.io/js/relaxed-json.svg)](http://badge.fury.io/js/relaxed-json)\n[![Dependency Status](https://david-dm.org/phadej/relaxed-json.svg)](https://david-dm.org/phadej/relaxed-json)\n[![devDependency Status](https://david-dm.org/phadej/relaxed-json/dev-status.svg)](https://david-dm.org/phadej/relaxed-json#info=devDependencies)\n[![Code Climate](https://img.shields.io/codeclimate/github/phadej/relaxed-json.svg)](https://codeclimate.com/github/phadej/relaxed-json)\n\nAre you frustrated that you cannot add comments into your configuration JSON\nRelaxed JSON is a simple solution.\nSmall JavaScript library with only one exposed function `RJSON.transform(text : string) : string`\n(and few convenient helpers).\n\n[Relaxed JSON](http://oleg.fi/relaxed-json) (modified BSD license) is a strict superset of JSON,\nrelaxing strictness of vanilla JSON.\nValid, vanilla JSON will not be changed by `RJSON.transform`. But there are few additional\nfeatures helping writing JSON by hand.\n\n* Comments are stripped : `// foo` and `/* bar */`  → `     `.\n  Comments are converted into whitespace, so your formatting is preserved.\n* Trailing comma is allowed : `[1, 2, 3, ]` → `[1, 2, 3]`. Works also in objects `{ \"foo\": \"bar\", }` → `{ \"foo\": \"bar\" }`.\n* Identifiers are transformed into strings : `{ foo: bar }` → `{ \"foo\": \"bar\" }`.\n* Single quoted strings are allowed : `'say \"Hello\"'` → `\"say \\\"Hello\\\"\"`.\n* More different characters is supported in identifiers: `foo-bar` → `\"foo-bar\"`.\n\n## API\n\n- `RJSON.transform(text : string) : string`.\n  Transforms Relaxed JSON text into JSON text. Doesn't verify (parse) the JSON, i.e result JSON might be invalid as well\n- `RJSON.parse(text : string, reviver : function | opts : obj) : obj`.\n  Parse the RJSON text, virtually `JSON.parse(JSON.transform(text), reviver)`.\n  You could pass a reviver function or an options object as the second argument. Supported options:\n  - `reviver`: you could still pass a reviver\n  - `relaxed`: use relaxed version of JSON (default: true)\n  - `warnings`: use relaxed JSON own parser, supports better error messages (default: false)\n  - `tolerant`: wait until the end to throw errors\n  - `duplicate`: fail if there are duplicate keys in objects\n\n## Executable\n\nThere is `rjson` executable\u003csup\u003e\u0026dagger;\u003c/sup\u003e\n\n```sh\n$ sudo npm install -g relaxed-json\n\n$ rjson relaxed-json.js\nError on line 27: Unexpected character: (\n(function () {\n\n% rjson package.json\n{\n  \"name\": \"relaxed-json\",\n  \"description\": \"Relaxed JSON is strict superset JSON, relaxing strictness of valilla JSON\",\n```\n\n\u003csup\u003e\u0026dagger;\u003c/sup\u003e`rjson` is similar to `python -mjson.tool`.\n\n## Changelog\n\n- 1.0.1 \u0026mdash; 2017-03-08 \u0026mdash; Meteor compatibility\n  - [#9](https://github.com/phadej/relaxed-json/issues/9)\n    [#14](https://github.com/phadej/relaxed-json/pull/14)\n    [#15](https://github.com/phadej/relaxed-json/pull/15)\n- 1.0.0 \u0026mdash; 2015-07-13 \u0026mdash; Stable release\n  - Forward slashes bug fixed\n- 0.2.9 Dependencies bump\n- 0.2.8 Dev dependencies update\n- 0.2.7 `rjson` executable\n  - also depedencies update\n  - jscs style check\n- 0.2.6 Dependencies update\n- 0.2.5 Use `make`\n- 0.2.4 Maintenance release\n- 0.2.3 Bugfixes\n  - `$` is valid identifier character\n  - single line comments may end with `CR` and `CRLF` also\n- 0.2.2 Bugfix\n- 0.2.1 Code reogranization\n  - More though into toleration, handles valid json without colons and commas\n  - trailing comma stripping is more strict\n- 0.2.0 Shiny new features\n  - overloaded `rjson.parse`\n  - tolerating parser support\n  - duplicate key warning\n  - test suite (!)\n- 0.1.1 RJSON.parse\n- 0.1.0 Initial release\n\n## Related projects\n\n- [strip-json-comments](https://www.npmjs.org/package/strip-json-comments)\n\nFor truly human writable configuration consider using [YAML](http://yaml.org/).\n\n- [js-yaml](https://www.npmjs.com/package/js-yaml)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphadej%2Frelaxed-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphadej%2Frelaxed-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphadej%2Frelaxed-json/lists"}