1 unstable release
0.1.0 | Feb 27, 2024 |
---|
#1633 in Encoding
18KB
352 lines
Usage
Add this to your Cargo.toml:
[dependencies]
jsurl = "0.1"
Description
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.
Example
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);
License
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.
Dependencies
~1.2–1.9MB
~35K SLoC