https://github.com/gapitio/json_string
Formats JSON string so that Serde can use it
https://github.com/gapitio/json_string
Last synced: 4 months ago
JSON representation
Formats JSON string so that Serde can use it
- Host: GitHub
- URL: https://github.com/gapitio/json_string
- Owner: gapitio
- License: apache-2.0
- Created: 2024-11-15T10:27:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-10T11:40:18.000Z (over 1 year ago)
- Last Synced: 2025-11-07T10:18:07.426Z (8 months ago)
- Language: Rust
- Size: 91.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
Formats a given string so that `serde_json` crate can understand it.
# Example 1
``` rust
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
``` rust
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);
```