json_string

Crates.iojson_string
lib.rsjson_string
version0.1.1
sourcesrc
created_at2024-11-15 10:35:41.468615
updated_at2024-11-15 12:14:13.603278
descriptionFormat JSON string so that `serde_json` can understand it.
homepage
repositoryhttps://github.com/gapitio/json_string
max_upload_size
id1448975
size26,403
Iron(III) Oxide (amab8901)

documentation

https://docs.rs/json_string

README

Formats a given string so that serde_json crate can understand it.

Example 1

use serial_test::serial;
use json_string::prepare_json_string;

let original_str = r#"
    [
        {"tag":"lol", "groups":[]}
    ]
"#;
let prepared_str = prepare_json_string(original_str);

let expected_str = r#"[{"tag": "lol"}]"#;

assert_eq!(prepared_str, expected_str);

Example 2

use serial_test::serial;
use json_string::prepare_json_string;

let original_str = r#"
    [
        {"label":"lol", "customtags": {"k1": "v1"}}
    ]
"#;
let prepared_str = prepare_json_string(original_str);

let expected_str = r#"[{"label": "lol", "customtags": {"k1": "v1"}}]"#;

assert_eq!(prepared_str, expected_str);

Commit count: 4

cargo fmt