{"id":17676524,"url":"https://github.com/yoannchb-pro/wtf-json","last_synced_at":"2025-05-12T22:15:37.078Z","repository":{"id":180766591,"uuid":"662268711","full_name":"yoannchb-pro/wtf-json","owner":"yoannchb-pro","description":"Parse any kind of broken json for scrapping easily","archived":false,"fork":false,"pushed_at":"2024-05-07T03:14:01.000Z","size":63,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-12T22:15:34.678Z","etag":null,"topics":["ast","broken-json","json-parser","nodejs","object-parsing","parser","tokenizer","typescript"],"latest_commit_sha":null,"homepage":"https://yoannchb-pro.github.io/wtf-json/","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/yoannchb-pro.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":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-04T18:30:12.000Z","updated_at":"2024-11-01T10:40:51.000Z","dependencies_parsed_at":"2024-05-07T04:25:43.184Z","dependency_job_id":"7bc604b0-d7ca-4df8-8aaf-54578e123bb3","html_url":"https://github.com/yoannchb-pro/wtf-json","commit_stats":null,"previous_names":["yoannchb-pro/wtf-json"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoannchb-pro%2Fwtf-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoannchb-pro%2Fwtf-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoannchb-pro%2Fwtf-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoannchb-pro%2Fwtf-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoannchb-pro","download_url":"https://codeload.github.com/yoannchb-pro/wtf-json/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253831009,"owners_count":21971008,"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":["ast","broken-json","json-parser","nodejs","object-parsing","parser","tokenizer","typescript"],"created_at":"2024-10-24T07:25:56.011Z","updated_at":"2025-05-12T22:15:37.042Z","avatar_url":"https://github.com/yoannchb-pro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wtf-json\n\nParse any kind of broken json for scrapping easily.\n\n## Goal\n\nThe primary objective is to ensure error-free parsing of JSON data. This tool enables you to parse any JSON or JavaScript object, regardless of its validity. Whether the input is a valid JSON or not, you can rely on this tool to handle it seamlessly without encountering any errors.\n\n## Update\n\nSee the [CHANGELOG](./CHANGELOG.md)\n\n## Install\n\n```\n$ npm i @yoannchb/wtf-json\n```\n\nOr with the CDN\n\n```html\n\u003cscript src=\"https://unpkg.com/@yoannchb/wtf-json@1.0.5/dist/index.js\"\u003e\u003c/script\u003e\n```\n\n## Import\n\nOnly for nodejs and module script\n\n```js\nimport wtfJson from \"wtf-json\";\n//or\nconst wtfJson = require(\"wtf-json\");\n```\n\n## Type\n\nBy default wtfJson return an `any` type but you can use generic type\n\n```ts\nwtfJson\u003c{ id: number }\u003e(\"{ id: 6 }\").id; //autocompletion work and id is a number :)\n```\n\n## Examples of use\n\n### Parse simple JSON\n\n```js\nwtfJson(\n  '{ \"name\": \"Will\", \"age\": 21, \"favorite-food\": [\"Matcha\", \"Dumpling\"] }'\n);\n/*\n * Will be parse as follow:\n * {\n *  name: \"Will\",\n *  age: 21,\n *  favorite-food: [\"Matcha\", \"Dumpling\"]\n * }\n */\n```\n\n### Parse JS object\n\n```js\nwtfJson(\n  '{ note: 20, coefficient: .5, student: \"Lili\", comments: [{ by: \"Teacher 1\", comment: \"Good Job!\" }], courses: undefined }'\n);\n/*\n * Will be parse as follow:\n * {\n *  note: 20,\n *  coefficient: 0.5,\n *  student: \"Lili\"\n *  comments: [{ by: \"Teacher 1\", comment: \"Good Job!\" }],\n *  courses: undefined\n * }\n */\n```\n\n### Parse broken JSON\n\n```js\nwtfJson(\n  '{ name Yoann, :\"isAdmin\":: true,, address: { country: `CA` }, null, {}, \"roles\": [::,,\\'admin\\' client, :user] }'\n);\n/*\n * Will be parse as follow:\n * {\n *  name: \"Yoann\",\n *  isAdmin: true,\n *  address: {\n *   country: \"CA\"\n *  },\n *  roles: [\"admin\", \"client\", \"user\"]\n * }\n */\n```\n\n### Parse multiples broken JSON\n\n```js\nwtfJson(`null,null\n,null,\\\\n\n{ data: [{ \"id\": 6 }] }`);\n/*\n * Will be parse as follow:\n * [\n *  null,\n *  null,\n *  null,\n *  \"\\n\",\n *  {\n *   data: { id: 6 }\n *  }\n * ]\n */\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoannchb-pro%2Fwtf-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoannchb-pro%2Fwtf-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoannchb-pro%2Fwtf-json/lists"}