{"id":15829835,"url":"https://github.com/imoxto/extract-json-from-text","last_synced_at":"2025-04-01T11:13:23.096Z","repository":{"id":171895239,"uuid":"648263380","full_name":"imoxto/extract-json-from-text","owner":"imoxto","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-15T11:54:33.000Z","size":82,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-12T11:10:54.740Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/imoxto.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":"2023-06-01T15:07:45.000Z","updated_at":"2024-01-09T04:29:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"9efb71f5-08d0-49df-8c65-2fbf8a6220bb","html_url":"https://github.com/imoxto/extract-json-from-text","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"b3e0ffc54a29758e565d4e1612cc3dee42eb2e68"},"previous_names":["imoxto/extract-json-from-text"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imoxto%2Fextract-json-from-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imoxto%2Fextract-json-from-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imoxto%2Fextract-json-from-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imoxto%2Fextract-json-from-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imoxto","download_url":"https://codeload.github.com/imoxto/extract-json-from-text/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246628229,"owners_count":20808106,"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-05T11:03:40.138Z","updated_at":"2025-04-01T11:13:23.059Z","avatar_url":"https://github.com/imoxto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Extract Json From Text\n\nExtract a JSON oboject or array from any piece of text\n\n## Usage\n\n### Install\n\n```bash\nnpm i extract-json-from-text\n```\n\n### Import\n\n```js\nconst { jsonFromText } = require(\"extract-json-from-text\");\n```\n\n```ts\nimport { jsonFromText } from \"extract-json-from-text\";\n```\n\n### Object Extraction\n\nBy default, it looks for an object in the string text\n\n```ts\nconst str = `Lorem ipsum dolor sit amet, { \"hello\": \"World\" } consectetur adipiscing elit.`;\nconst jsonResults = jsonFromText(str);\nconsole.log(jsonResults); // Object { \"hello\": \"World\" }\n```\n\n### Array\n\nIf you have to extract an array from the text\n\n```ts\nconst str = `Lorem ipsum dolor sit amet, [ \"hello\", \"World\" ] consectetur adipiscing elit.`;\nconst jsonResults = jsonFromText(str, \"array\");\nconsole.log(jsonResults); // Array [ \"hello\", \"World\" ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimoxto%2Fextract-json-from-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimoxto%2Fextract-json-from-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimoxto%2Fextract-json-from-text/lists"}