{"id":28433475,"url":"https://github.com/dreampast/efjson-rust","last_synced_at":"2026-05-01T02:33:02.909Z","repository":{"id":296401456,"uuid":"992003977","full_name":"DreamPast/efjson-rust","owner":"DreamPast","description":"a streaming JSON parser","archived":false,"fork":false,"pushed_at":"2025-06-24T14:09:15.000Z","size":252,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-01T02:32:49.165Z","etag":null,"topics":["json","json5","jsonc","rust","streaming"],"latest_commit_sha":null,"homepage":"","language":"C++","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/DreamPast.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,"zenodo":null}},"created_at":"2025-05-28T13:23:24.000Z","updated_at":"2025-06-24T14:09:19.000Z","dependencies_parsed_at":"2025-05-30T18:41:20.182Z","dependency_job_id":"56dafd9d-f71e-42e2-8ab7-cdf3d3e8397e","html_url":"https://github.com/DreamPast/efjson-rust","commit_stats":null,"previous_names":["dreampast/efjson-rust"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DreamPast/efjson-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DreamPast%2Fefjson-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DreamPast%2Fefjson-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DreamPast%2Fefjson-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DreamPast%2Fefjson-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DreamPast","download_url":"https://codeload.github.com/DreamPast/efjson-rust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DreamPast%2Fefjson-rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32483406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["json","json5","jsonc","rust","streaming"],"created_at":"2025-06-05T18:09:52.263Z","updated_at":"2026-05-01T02:33:02.903Z","avatar_url":"https://github.com/DreamPast.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Streaming and Event-driven JSON Parser\n\n[English](./README.md) [简体中文](./README.zh.md)\n\nOther programming languages:\n\n- [Typescript](https://github.com/DreamPast/efjson)\n- [C/C++](https://github.com/DreamPast/efjson-cpp)\n\n## Features\n\n- supports JSON5 and JSONC\n- stream parser requires minimal memory when no events are triggered\n- provides deserialization, which is also streaming\n\n## Example\n\n### Stream Parsing\n\n```rust\nuse efjson::{stream_parser::StreamParser, ParserOption};\n\nconst SRC: \u0026'static str = r#\"{\n\"N\":null,\"T\":true,\"F\":false,\n\"str\":\"str,\\\"esc\\\",\\uD83D\\uDE00,😊\",\n\"num\":-1.2e3,\"arr\":[\"A\",{\"obj\":\"B\"}]\n}\"#;\nfn test_stream() {\n  let tokens = StreamParser::parse(ParserOption::default(), SRC).unwrap();\n  for item in tokens {\n    println!(\"{:?}\", item);\n  }\n}\n\nfn main() {\n  test_stream();\n}\n```\n\n### Deserialize\n\n```rust\nuse std::collections::HashMap;\n\nuse efjson::{\n  JsonValue, ParserOption,\n  deserialize::{JsonRawString, JsonRawToken, deserialize},\n};\n\nfn test_deserialize() {\n  println!(\"{:?}\", deserialize::\u003cVec\u003cf64\u003e\u003e(ParserOption::all(), \"[1,.1,1.,1.234e3]\"));\n  println!(\"{:?}\", deserialize::\u003cVec\u003cf64\u003e\u003e(ParserOption::all(), \"[0x1234,0o1234,0b1011]\"));\n  println!(\"{:?}\", deserialize::\u003cVec\u003cf64\u003e\u003e(ParserOption::all(), \"[Infinity,-Infinity,NaN]\"));\n  println!(\"{:?}\", deserialize::\u003cVec\u003ci64\u003e\u003e(ParserOption::all(), \"[-0x1234,0o1234,+0b1011]\"));\n  println!(\n    \"{:?}\\t{:?}\",\n    deserialize::\u003cVec\u003cbool\u003e\u003e(ParserOption::all(), \"[true,false]\"),\n    deserialize::\u003c()\u003e(ParserOption::all(), \"null\")\n  );\n  println!(\n    \"{:?}\",\n    deserialize::\u003c[i32; 4]\u003e(ParserOption::all(), \"[1,2,3,4]\")\n  );\n  println!(\n    \"{:?}\",\n    deserialize::\u003cHashMap\u003cString, Option\u003ci32\u003e\u003e\u003e(ParserOption::all(), \"{'a':1,'b':null,}\")\n  );\n\n  {\n    println!(\"[\");\n    for token in\n      deserialize::\u003cJsonRawToken\u003e(ParserOption::all(), r#\"{'a':12,b:[13,14]}\"#).unwrap().tokens\n    {\n      println!(\"    {:?}\", token);\n    }\n    println!(\"]\");\n  }\n\n  println!(\n    \"{:?}\\t\",\n    vec![\n      deserialize::\u003c(String, i32)\u003e(ParserOption::all(), r#\"[\"a\",12]\"#),\n      deserialize::\u003c(String, i32)\u003e(ParserOption::all(), r#\"[\"a\",12,]\"#),\n      deserialize::\u003c(String, i32)\u003e(ParserOption::all(), r#\"[]\"#),\n      deserialize::\u003c(String, i32)\u003e(ParserOption::all(), r#\"[\"a\",]\"#),\n      deserialize::\u003c(String, i32)\u003e(ParserOption::all(), r#\"[\"a\",12,13]\"#)\n    ]\n  );\n\n  println!(\n    \"{:?}\",\n    deserialize::\u003cHashMap\u003cString, JsonRawString\u003e\u003e(\n      ParserOption::all(),\n      r#\"{'a':1.2e3,'b':null,'c':\"str\",'d':[13,14],'e':{a:12,},}\"#\n    )\n    .unwrap()\n    .iter()\n    .map(|(k, v)| (k, \u0026v.json))\n    .collect::\u003cHashMap\u003c_, _\u003e\u003e()\n  );\n  println!(\n    \"{:?}\",\n    deserialize::\u003cVec\u003cJsonRawString\u003e\u003e(\n      ParserOption::all(),\n      r#\"[1.2e3,null,\"str\",[13,14,],{a:12,},]\"#\n    )\n    .unwrap()\n    .iter_mut()\n    .map(|x| \u0026x.json)\n    .collect::\u003cVec\u003c_\u003e\u003e()\n  );\n  println!(\n    \"{:?}\",\n    deserialize::\u003cJsonValue\u003e(ParserOption::all(), r#\"[1.2e3,null,\"str\",[13,14,],{\"a\":12,},]\"#)\n      .unwrap()\n  );\n}\n\nfn main() {\n  test_deserialize();\n}\n```\n\nAnd you can use `derive`:\n\n```rust\nuse std::collections::HashMap;\n\nuse efjson::{deserialize::deserialize, Deserializable, ParserOption};\n\nconst SRC: \u0026'static str = r#\"{\n\"n\":null,\"t\":true,\"f\":false,\n\"str\":\"str,\\\"esc\\\",\\uD83D\\uDE00,😊\",\n\"num\":-1.2e3,\"arr\":[\"A\",{\"obj\":\"B\"}]\n}\"#;\n\n#[derive(Debug, Deserializable)]\n#[allow(dead_code)]\nstruct Struct {\n  n: (),\n  t: bool,\n  f: bool,\n  str: String,\n  num: f64,\n  arr: (String, HashMap\u003cString, String\u003e),\n}\n\nfn main() {\n  let r: Result\u003cStruct, _\u003e = deserialize(ParserOption::all(), SRC);\n  println!(\"{:#?}\", r);\n}\n```\n\n## References\n\nJSON Specification: [RFC 4627 on JSON](https://www.ietf.org/rfc/rfc4627.txt)\n\nJSON State Diagram: [JSON](https://www.json.org/)\n\nJSON5 Specification: [The JSON5 Data Interchange Format](https://spec.json5.org/)\n\nJSON Pointer: [JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901)\n\nRelative JSON Pointers: [Relative JSON Pointers](https://datatracker.ietf.org/doc/html/draft-bhutton-relative-json-pointer-00)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreampast%2Fefjson-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdreampast%2Fefjson-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreampast%2Fefjson-rust/lists"}