{"id":29308849,"url":"https://github.com/andrewnester/rust-jsonm","last_synced_at":"2025-07-07T07:18:40.551Z","repository":{"id":33023465,"uuid":"150121683","full_name":"andrewnester/rust-jsonm","owner":"andrewnester","description":"jsonm implementation port for Rust.","archived":false,"fork":false,"pushed_at":"2024-03-06T15:00:02.000Z","size":33,"stargazers_count":7,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-02T13:17:48.223Z","etag":null,"topics":["compress","json","jsonm","packing","performance","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/jsonm","language":"Rust","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/andrewnester.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}},"created_at":"2018-09-24T15:06:43.000Z","updated_at":"2024-07-12T16:58:37.000Z","dependencies_parsed_at":"2022-09-16T17:20:31.703Z","dependency_job_id":null,"html_url":"https://github.com/andrewnester/rust-jsonm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrewnester/rust-jsonm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewnester%2Frust-jsonm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewnester%2Frust-jsonm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewnester%2Frust-jsonm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewnester%2Frust-jsonm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewnester","download_url":"https://codeload.github.com/andrewnester/rust-jsonm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewnester%2Frust-jsonm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264032595,"owners_count":23546820,"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":["compress","json","jsonm","packing","performance","rust"],"created_at":"2025-07-07T07:18:32.719Z","updated_at":"2025-07-07T07:18:40.541Z","avatar_url":"https://github.com/andrewnester.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-jsonm\n\n[![Build Status](https://travis-ci.org/andrewnester/rust-jsonm.svg?branch=master)](https://travis-ci.org/andrewnester/rust-jsonm)\n\n**jsonm** implementation port for Rust.\n\nOriginal library written in JS is here: https://github.com/lennartcl/jsonm\n\n\u003e jsonm is a fast and safe way to compress JSON messages using memoization. jsonm makes messages up to several orders of magnitude smaller by getting rid of repeated names and values.\n\n\u003e jsonm packs\n```\n[\n    { \"firstName\": \"Francis\", \"lastName\": \"Doe\" },\n    { \"firstName\": \"Anna\", \"lastName\": \"Smith\" },\n    { \"firstName\": \"Agent\", \"lastName\": \"Smith\", \"isAlias\": true },\n    { \"firstName\": \"Anna\", \"lastName\": \"Francis\" }\n]\n```\n\u003e into\n```\n[ 0,\n    [\"firstName\", \"lastName\", \"Francis\", \"Doe\"],\n    [3, 4, \"Anna\", \"Smith\"],\n    [3, 4, \"isAlias\", \"Agent\", 8, true],\n    [3, 4, 7, 5]\n]\n```\n\u003e Notice how it eliminates all common substrings like \"firstName\" using memoization! jsonm keeps a dictionary to compress future messages even further. Send the message above a second time, and it becomes:\n```\n[0,[3,4,5,6],[3,4,7,8],[3,4,9,10,8,11],[3,4,7,5],1]\n```\n\u003e And\n```\n[\n    { \"firstName\": \"Bryan\", \"lastName\": \"Fuller\" },\n    { \"firstName\": \"Anna\", \"lastName\": \"Adams\" },\n    { \"firstName\": \"Tim\", \"lastName\": \"Peterson\" },\n    { \"firstName\": \"Francis\", \"lastName\": \"Peterson\" }\n]\n```\n\u003e becomes\n```\n[0,[3,4,\"Bryan\",\"Fuller\"],[3,4,7,\"Adams\"],[3,4,\"Tim\",\"Peterson\"],[3,4,5,16]]\n```\n\u003e By avoiding repetition, jsonm can for example help decrease the size of messages sent from a web server to the client. It effectively leaves out all information the client already knows about.\n\n## Installation\n\n    [dependencies]\n    \"jsonm\" = \"0.1\"\n\n## Examples\n    \n    #[macro_use]\n    extern crate serde_json;\n    extern crate jsonm;\n    \n    use jsonm::packer::{PackOptions, Packer};\n    use jsonm::unpacker::Unpacker;\n    \n    let mut packer = Packer::new();\n    let options = PackOptions::new();\n    let packed = packer.pack(\u0026json!({ \"bar\": 1, \"foo\": \"1\" }), \u0026options).unwrap(); // packed is [\"bar\", \"foo\", \"1\", \"~1\", 0]\n    \n    let mut unpacker = Unpacker::new();\n    let unpacked: Value = unpacker.unpack(\u0026packed).unwrap(); // unpacked is Object({ \"bar\": 1, \"foo\": \"1\" })\n    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewnester%2Frust-jsonm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewnester%2Frust-jsonm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewnester%2Frust-jsonm/lists"}