{"id":18775997,"url":"https://github.com/way29/jsonextractor","last_synced_at":"2025-09-01T22:31:30.289Z","repository":{"id":143230683,"uuid":"615155718","full_name":"WAY29/jsonextractor","owner":"WAY29","description":"Go module for extracting valid JSON objects from anywhere","archived":false,"fork":false,"pushed_at":"2023-03-17T04:47:15.000Z","size":5,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T02:51:12.359Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WAY29.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-03-17T04:15:46.000Z","updated_at":"2024-07-27T22:55:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"9905d38d-1517-491d-af76-c1fc006a13d2","html_url":"https://github.com/WAY29/jsonextractor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WAY29/jsonextractor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WAY29%2Fjsonextractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WAY29%2Fjsonextractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WAY29%2Fjsonextractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WAY29%2Fjsonextractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WAY29","download_url":"https://codeload.github.com/WAY29/jsonextractor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WAY29%2Fjsonextractor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273202266,"owners_count":25063272,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-07T19:44:28.808Z","updated_at":"2025-09-01T22:31:29.990Z","avatar_url":"https://github.com/WAY29.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Extractor\nJSON Extractor is a Go module for extracting valid JSON objects from anywhere, It is also used in the [yak](https://github.com/yaklang/yakit).\n\n## Installation\n```bash\ngo get -u github.com/WAY29/jsonextractor\n```\n\n## Usage\n### Fix JSON\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/WAY29/jsonextractor\"\n)\n\nfunc main() {\n    // fix invalid json escape\n\tstr := `{\"message\": \"This is not a valid JSON string \\x0A\"}`\n\tfixed, ok := jsonextractor.FixJson([]byte(str))\n\tfmt.Println(string(fixed)) // Output: {\"message\": \"This is not a valid JSON string \\u000a\"}\n    fmt.Println(ok) // Output: true\n    fixed, ok = FixJson([]byte(`{\"abc\": 123,}`))\n\tfmt.Println(string(fixed)) // Output: {\"abc\": 123}\n    fmt.Println(ok) // Output: true\n}\n```\n\n### Extract JSON Objects\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/WAY29/jsonextractor\"\n)\n\nfunc main() {\n\tstr := `// something trush...\n    \u003chtml\u003e \u003c!-- something html--\u003e\n    {\"name\": \"John\", \"age\": 25}{\"name\": \"Jim\", \"age\": 30}\u003c/html\u003e`\n\tresults, _, err := jsonextractor.ExtractJSONWithRaw(str)\n    if err != nil {\n        panic(err)\n    }\n\tfor _, r := range results {\n\t\tfmt.Println(r)\n\t}\n    // Output:\n\t// {\"name\": \"John\", \"age\": 25}\n\t// {\"name\": \"Jim\", \"age\": 30}\n\n    // or use ExtractStandardJSON\n    results2 := jsonextractor.ExtractStandardJSON(str)\n\tfor _, r := range results2 {\n\t\tfmt.Println(r)\n\t}\n    // Output:\n\t// {\"name\": \"John\", \"age\": 25}\n\t// {\"name\": \"Jim\", \"age\": 30}\n}\n```\n\n## License\nThe module is licensed under the MIT license.\n\n\n## Thanks\nOriginal author: [VillanCh](https://github.com/VillanCh)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fway29%2Fjsonextractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fway29%2Fjsonextractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fway29%2Fjsonextractor/lists"}