{"id":15698531,"url":"https://github.com/drom/jsof","last_synced_at":"2025-07-25T19:41:38.994Z","repository":{"id":57284623,"uuid":"40799692","full_name":"drom/jsof","owner":"drom","description":":open_hands: liberal JSON","archived":false,"fork":false,"pushed_at":"2023-05-24T06:30:00.000Z","size":96,"stargazers_count":6,"open_issues_count":9,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T11:18:18.768Z","etag":null,"topics":[],"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/drom.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-16T05:09:58.000Z","updated_at":"2023-05-30T21:35:17.000Z","dependencies_parsed_at":"2024-06-21T15:36:31.031Z","dependency_job_id":null,"html_url":"https://github.com/drom/jsof","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drom%2Fjsof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drom%2Fjsof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drom%2Fjsof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drom%2Fjsof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drom","download_url":"https://codeload.github.com/drom/jsof/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253173887,"owners_count":21865767,"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-03T19:29:28.926Z","updated_at":"2025-05-09T01:29:41.435Z","avatar_url":"https://github.com/drom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSOF (liberal JSON)\n[![NPM version](https://img.shields.io/npm/v/jsof.svg)](https://www.npmjs.org/package/jsof)\n[![Tests](https://github.com/drom/jsof/workflows/Tests/badge.svg)](https://github.com/drom/jsof/actions)\n[![Coveralls](https://coveralls.io/repos/github/drom/jsof/badge.svg?branch=master)](https://coveralls.io/github/drom/jsof?branch=master)\n\nUses `esprima, escodegen` or `shift-{parser, codegen}` to parse and stringify an JavaScript values.\n\n## Why?\n### Reason 1\nDo you think, that JSON is a bit verbose? restrictive? hard to comment?\n\nRemember, you wrote something like the text below,  gave it to `JSON.parse()` and got 30 errors? one by one?\n\n```json\n{\n    unquoted_key: \"keys must be quoted\",\n    a1: [\"extra comma\",],\n    a2: [\"double extra comma\",,],\n    // single line comment\n    \"Illegal expression\": 1 + 2,\n    \"Illegal invocation\": alert(),\n    \"Numbers cannot have leading zeroes\": 013,\n    \"Numbers cannot be hex\": 0x14,\n    a3: [\n        \"Illegal backslash escape: \\x15\",\n        \"Illegal backslash escape: \\017\",\n        [[[[[[[[[[[[[[[[[[[[\"Too deep\"]]]]]]]]]]]]]]]]]]]],\n        \"Bad value\", truth,\n        'single quote',\n        /* multi-line comment */\n        \"    tab    character    in    string    \",\n        \"tab\\   character\\   in\\  string\\  \",\n        \"line\\\n        break\"\n    ],\n    \"Extra comma\": true,\n}\n```\n\nSo, now you can use `jsof.parse()`, and everything is fine!\n\n### Reason 2\n`JSON.stringify(obj, null, 2);`\n\n```json\n{\n  \"a\": [\n    {\"b\": [\n      [\n        \"string\"\n      ]\n    ]}\n  ],\n  \"c\": 42\n}\n```\n\n`jsof.stringify(obj);`\n\n```js\n{\n  a: [{b: 'string'}],\n  c: 42\n}\n```\n\n### Reason 3\ncolors\n\n### Reason 4\nReferences\n\n### Reason 5\nno `eval()` no `Yaml`\n\n### Reason 6\nBetter error messages.\n\n## Use\n### Node.js\n\n```\nnpm i jsof --save\n```\n\n```js\nvar jsof = require('jsof');\n```\n\n## API\n### jsof.parse()\n### jsof.p()\nThe `jsof.parse()` method parses a JS value string and returns a JavaScript value. Passes all 3 JSON **pass** tests. Also passes 18 of 33 JSON **fail** tests.\n\n`value = jsof.parse(text)`\n\n### jsof.stringify()\n### jsof.s()\nThe `jsof.stringify()` method converts a JavaScript value to a JS string.\n\n`text = jsof.stringify(value)`\n\n### jsof.shift.parse()\n### jsof.shift.p()\nThe same as `jsof.parse()` but using `shift-*` tools.\n\n### jsof.shift.stringify()\n### jsof.shift.s()\nThe same as `jsof.stringify()` but using `shift-*` tools.\n\n## Testing\n`npm test`\n\n## License\nMIT [LICENSE](https://github.com/drom/jsof/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrom%2Fjsof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrom%2Fjsof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrom%2Fjsof/lists"}