{"id":15387264,"url":"https://github.com/rhysd/tinyjson","last_synced_at":"2025-04-05T06:07:08.744Z","repository":{"id":52550905,"uuid":"63630766","full_name":"rhysd/tinyjson","owner":"rhysd","description":"Simple JSON parser/generator for Rust","archived":false,"fork":false,"pushed_at":"2023-01-10T10:57:32.000Z","size":251,"stargazers_count":107,"open_issues_count":2,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T05:06:55.487Z","etag":null,"topics":["json","json-generator","json-parser","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/tinyjson","language":"Rust","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/rhysd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-18T19:25:47.000Z","updated_at":"2025-02-06T14:22:33.000Z","dependencies_parsed_at":"2023-02-08T18:31:09.853Z","dependency_job_id":null,"html_url":"https://github.com/rhysd/tinyjson","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Ftinyjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Ftinyjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Ftinyjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Ftinyjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhysd","download_url":"https://codeload.github.com/rhysd/tinyjson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294536,"owners_count":20915340,"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":["json","json-generator","json-parser","rust"],"created_at":"2024-10-01T14:53:06.786Z","updated_at":"2025-04-05T06:07:08.722Z","avatar_url":"https://github.com/rhysd.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"tinyjson\n========\n[![version](https://img.shields.io/crates/v/tinyjson.svg)](https://crates.io/crates/tinyjson)\n[![CI](https://github.com/rhysd/tinyjson/workflows/CI/badge.svg?branch=master\u0026event=push)](https://github.com/rhysd/tinyjson/actions)\n\n[tinyjson](https://crates.io/crates/tinyjson) is a library to parse/generate JSON format document.\n\nGoals of this library are\n\n- **Simplicity**: This library uses standard containers like `Vec` or `HashMap` as its internal representation\n  and exposes it to users. Users can operate JSON values via the standard APIs. And it keeps this crate as small\n  as possible.\n- **Explicit**: This library does not hide memory allocation from users. You need to allocate memory like `Vec`,\n  `String`, `HashMap` by yourself. It is good for readers of your source code to show where memory allocations\n  happen. And you can have control of how memory is allocated (e.g. allocating memory in advance with\n  `with_capacity` method).\n- **No dependencies**: This library is built on top of only standard libraries.\n- **No unsafe code**: This library is built with Safe Rust.\n- **Well tested**: This library is tested with famous test suites:\n  - [JSON checker in json.org](http://www.json.org/JSON_checker/)\n  - [JSONTestSuite](https://github.com/nst/JSONTestSuite)\n  - [JSON-Schema-Test-Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite)\n\n[Documentation](https://docs.rs/tinyjson/latest/tinyjson)\n\n## Requirements\n\nRust stable toolchain.\n\n## Installation\n\nAdd this crate to `dependencies` section of your `Cargo.toml`\n\n```toml\n[dependencies]\ntinyjson = \"2\"\n```\n\n## Example\n\n```rust\nuse tinyjson::JsonValue;\nuse std::collections::HashMap;\nuse std::convert::TryInto;\n\nlet s = r#\"\n    {\n        \"bool\": true,\n        \"arr\": [1, null, \"test\"],\n        \"nested\": {\n            \"blah\": false,\n            \"blahblah\": 3.14\n        },\n        \"unicode\": \"\\u2764\"\n    }\n\"#;\n\n// Parse from strings\nlet parsed: JsonValue = s.parse().unwrap();\n\n// Access to inner value represented with standard containers\nlet object: \u0026HashMap\u003c_, _\u003e = parsed.get().unwrap();\nprintln!(\"Parsed HashMap: {:?}\", object);\n\n// Generate JSON string\nprintln!(\"{}\", parsed.stringify().unwrap());\n// Generate formatted JSON string with indent\nprintln!(\"{}\", parsed.format().unwrap());\n\n// Access nested elements by .query() or .query_mut() without panic\nlet elem = parsed.query().child(\"arr\").child(1).find();\nprintln!(\"Second element of \\\"arr\\\": {:?}\", elem);\n\n// Convert to inner value represented with standard containers\nlet object: HashMap\u003c_, _\u003e = parsed.try_into().unwrap();\nprintln!(\"Converted into HashMap: {:?}\", object);\n\n// Create JSON values from standard containers\nlet mut m = HashMap::new();\nm.insert(\"foo\".to_string(), true.into());\nlet mut v = JsonValue::from(m);\n\n// Access with `Index` and `IndexMut` operators quickly (panic when no element)\nprintln!(\"{:?}\", v[\"foo\"]);\nv[\"foo\"] = JsonValue::from(\"hello\".to_string());\nprintln!(\"{:?}\", v[\"foo\"]);\n```\n\nSee [the document](https://docs.rs/tinyjson/latest/tinyjson) to know all APIs.\n\n## Repository\n\nhttps://github.com/rhysd/tinyjson\n\n## License\n\n[the MIT License](LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Ftinyjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhysd%2Ftinyjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Ftinyjson/lists"}