Crates.io | jsurl |
lib.rs | jsurl |
version | 0.1.0 |
source | src |
created_at | 2024-02-27 02:41:24.572804 |
updated_at | 2024-02-27 02:41:24.572804 |
description | A more compact and human-readable alternative to JSON + URL encoding. |
homepage | https://github.com/Chriscbr/jsurl-rs |
repository | https://github.com/Chriscbr/jsurl-rs |
max_upload_size | |
id | 1154424 |
size | 35,322 |
Add this to your Cargo.toml:
[dependencies]
jsurl = "0.1"
This crate is a Rust implementation of the jsurl serialization format. It is a more compact and human-readable alternative to plain URL encoding for including JSON in URLs.
use jsurl::{deserialize, serialize};
use serde_json::json;
let obj = json!({
"name": "John Doe",
"age": 42,
"children": ["Mary", "Bill"]
});
let serialized = serialize(&obj);
assert_eq!(serialized, "~(name~'John*20Doe~age~42~children~(~'Mary~'Bill))");
let deserialized = deserialize("~(name~'John*20Doe~age~42~children~(~'Mary~'Bill))").unwrap();
assert_eq!(deserialized, obj);
Dual-licensed for compatibility with the Rust project.
Licensed under the Apache License Version 2.0: http://www.apache.org/licenses/LICENSE-2.0, or the MIT license: http://opensource.org/licenses/MIT, at your option.