{"id":18707521,"url":"https://github.com/pydantic/jiter","last_synced_at":"2026-04-10T16:03:43.046Z","repository":{"id":194036681,"uuid":"555491597","full_name":"pydantic/jiter","owner":"pydantic","description":"Fast iterable JSON parser.","archived":false,"fork":false,"pushed_at":"2024-05-22T16:15:48.000Z","size":461,"stargazers_count":93,"open_issues_count":7,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-22T16:17:51.974Z","etag":null,"topics":["json","json-parser","pydantic","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/jiter","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/pydantic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"samuelcolvin"}},"created_at":"2022-10-21T17:31:20.000Z","updated_at":"2024-05-28T11:45:45.470Z","dependencies_parsed_at":"2023-10-01T16:53:03.066Z","dependency_job_id":"2f3587c5-3985-4e87-a249-c82cd1edbc4f","html_url":"https://github.com/pydantic/jiter","commit_stats":null,"previous_names":["pydantic/jiter"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydantic%2Fjiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydantic%2Fjiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydantic%2Fjiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydantic%2Fjiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pydantic","download_url":"https://codeload.github.com/pydantic/jiter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174423,"owners_count":20896078,"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-parser","pydantic","rust"],"created_at":"2024-11-07T12:18:46.886Z","updated_at":"2026-04-10T16:03:43.008Z","avatar_url":"https://github.com/pydantic.png","language":"Rust","readme":"# jiter\n\n[![CI](https://github.com/pydantic/jiter/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/pydantic/jiter/actions/workflows/ci.yml?query=branch%3Amain)\n[![Crates.io](https://img.shields.io/crates/v/jiter?color=green)](https://crates.io/crates/jiter)\n[![CodSpeed Badge](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://codspeed.io/pydantic/jiter)\n\nFast iterable JSON parser.\n\nDocumentation is available at [docs.rs/jiter](https://docs.rs/jiter).\n\njiter has three interfaces:\n* `JsonValue` an enum representing JSON data\n* `Jiter` an iterator over JSON data\n* `PythonParse` which parses a JSON string into a Python object\n\n## JsonValue Example\n\nSee [the `JsonValue` docs](https://docs.rs/jiter/latest/jiter/enum.JsonValue.html) for more details.\n\n```rust\nuse jiter::JsonValue;\n\nlet json_data = r#\"\n    {\n        \"name\": \"John Doe\",\n        \"age\": 43,\n        \"phones\": [\n            \"+44 1234567\",\n            \"+44 2345678\"\n        ]\n    }\"#;\nlet json_value = JsonValue::parse(json_data.as_bytes(), true).unwrap();\nprintln!(\"{:#?}\", json_value);\n```\n\nreturns:\n\n```text\nObject(\n    {\n        \"name\": Str(\"John Doe\"),\n        \"age\": Int(43),\n        \"phones\": Array(\n            [\n                Str(\"+44 1234567\"),\n                Str(\"+44 2345678\"),\n            ],\n        ),\n    },\n)\n```\n\n## Jiter Example\n\nTo use [Jiter](https://docs.rs/jiter/latest/jiter/struct.Jiter.html), you need to know what schema you're expecting:\n\n```rust\nuse jiter::{Jiter, NumberInt, Peek};\n\nlet json_data = r#\"\n    {\n        \"name\": \"John Doe\",\n        \"age\": 43,\n        \"phones\": [\n            \"+44 1234567\",\n            \"+44 2345678\"\n        ]\n    }\"#;\nlet mut jiter = Jiter::new(json_data.as_bytes());\nassert_eq!(jiter.next_object().unwrap(), Some(\"name\"));\nassert_eq!(jiter.next_str().unwrap(), \"John Doe\");\nassert_eq!(jiter.next_key().unwrap(), Some(\"age\"));\nassert_eq!(jiter.next_int().unwrap(), NumberInt::Int(43));\nassert_eq!(jiter.next_key().unwrap(), Some(\"phones\"));\nassert_eq!(jiter.next_array().unwrap(), Some(Peek::String));\n// we know the next value is a string as we just asserted so\nassert_eq!(jiter.known_str().unwrap(), \"+44 1234567\");\nassert_eq!(jiter.array_step().unwrap(), Some(Peek::String));\n// same again\nassert_eq!(jiter.known_str().unwrap(), \"+44 2345678\");\n// next we'll get `None` from `array_step` as the array is finished\nassert_eq!(jiter.array_step().unwrap(), None);\n// and `None` from `next_key` as the object is finished\nassert_eq!(jiter.next_key().unwrap(), None);\n// and we check there's nothing else in the input\njiter.finish().unwrap();\n```\n\n## Benchmarks\n\n_There are lies, damned lies and benchmarks._\n\nIn particular, serde-json benchmarks use `serde_json::Value` which is significantly slower than deserializing\nto a string.\n\nFor more details, see [the benchmarks](https://github.com/pydantic/jiter/tree/main/crates/jiter/benches).\n\n```text\nrunning 48 tests\ntest big_jiter_iter                    ... bench:   3,662,616 ns/iter (+/- 88,878)\ntest big_jiter_value                   ... bench:   6,998,605 ns/iter (+/- 292,383)\ntest big_serde_value                   ... bench:  29,793,191 ns/iter (+/- 576,173)\ntest bigints_array_jiter_iter          ... bench:      11,836 ns/iter (+/- 414)\ntest bigints_array_jiter_value         ... bench:      28,979 ns/iter (+/- 938)\ntest bigints_array_serde_value         ... bench:     129,797 ns/iter (+/- 5,096)\ntest floats_array_jiter_iter           ... bench:      19,302 ns/iter (+/- 631)\ntest floats_array_jiter_value          ... bench:      31,083 ns/iter (+/- 921)\ntest floats_array_serde_value          ... bench:     208,932 ns/iter (+/- 6,167)\ntest lazy_map_lookup_1_10              ... bench:         615 ns/iter (+/- 15)\ntest lazy_map_lookup_2_20              ... bench:       1,776 ns/iter (+/- 36)\ntest lazy_map_lookup_3_50              ... bench:       4,291 ns/iter (+/- 77)\ntest massive_ints_array_jiter_iter     ... bench:      62,244 ns/iter (+/- 1,616)\ntest massive_ints_array_jiter_value    ... bench:      82,889 ns/iter (+/- 1,916)\ntest massive_ints_array_serde_value    ... bench:     498,650 ns/iter (+/- 47,759)\ntest medium_response_jiter_iter        ... bench:           0 ns/iter (+/- 0)\ntest medium_response_jiter_value       ... bench:       3,521 ns/iter (+/- 101)\ntest medium_response_jiter_value_owned ... bench:       6,088 ns/iter (+/- 180)\ntest medium_response_serde_value       ... bench:       9,383 ns/iter (+/- 342)\ntest pass1_jiter_iter                  ... bench:           0 ns/iter (+/- 0)\ntest pass1_jiter_value                 ... bench:       3,048 ns/iter (+/- 79)\ntest pass1_serde_value                 ... bench:       6,588 ns/iter (+/- 232)\ntest pass2_jiter_iter                  ... bench:         384 ns/iter (+/- 9)\ntest pass2_jiter_value                 ... bench:       1,259 ns/iter (+/- 44)\ntest pass2_serde_value                 ... bench:       1,237 ns/iter (+/- 38)\ntest sentence_jiter_iter               ... bench:         283 ns/iter (+/- 10)\ntest sentence_jiter_value              ... bench:         357 ns/iter (+/- 15)\ntest sentence_serde_value              ... bench:         428 ns/iter (+/- 9)\ntest short_numbers_jiter_iter          ... bench:           0 ns/iter (+/- 0)\ntest short_numbers_jiter_value         ... bench:      18,085 ns/iter (+/- 613)\ntest short_numbers_serde_value         ... bench:      87,253 ns/iter (+/- 1,506)\ntest string_array_jiter_iter           ... bench:         615 ns/iter (+/- 18)\ntest string_array_jiter_value          ... bench:       1,410 ns/iter (+/- 44)\ntest string_array_jiter_value_owned    ... bench:       2,863 ns/iter (+/- 151)\ntest string_array_serde_value          ... bench:       3,467 ns/iter (+/- 60)\ntest true_array_jiter_iter             ... bench:         299 ns/iter (+/- 8)\ntest true_array_jiter_value            ... bench:         995 ns/iter (+/- 29)\ntest true_array_serde_value            ... bench:       1,207 ns/iter (+/- 36)\ntest true_object_jiter_iter            ... bench:       2,482 ns/iter (+/- 84)\ntest true_object_jiter_value           ... bench:       2,058 ns/iter (+/- 45)\ntest true_object_serde_value           ... bench:       7,991 ns/iter (+/- 370)\ntest unicode_jiter_iter                ... bench:         315 ns/iter (+/- 7)\ntest unicode_jiter_value               ... bench:         389 ns/iter (+/- 6)\ntest unicode_serde_value               ... bench:         445 ns/iter (+/- 6)\ntest x100_jiter_iter                   ... bench:          12 ns/iter (+/- 0)\ntest x100_jiter_value                  ... bench:          20 ns/iter (+/- 1)\ntest x100_serde_iter                   ... bench:          72 ns/iter (+/- 3)\ntest x100_serde_value                  ... bench:          83 ns/iter (+/- 3)\n```\n","funding_links":["https://github.com/sponsors/samuelcolvin"],"categories":["Rust","Data Processing"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpydantic%2Fjiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpydantic%2Fjiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpydantic%2Fjiter/lists"}