Crates.io | json_keyquotes_convert |
lib.rs | json_keyquotes_convert |
version | 0.2.3 |
source | src |
created_at | 2022-09-26 09:08:39.942251 |
updated_at | 2023-08-17 15:42:51.992831 |
description | A Rust library crate to convert JSON from and to JSON without key-quotes. |
homepage | |
repository | https://github.com/Andreas02-dev/json_keyquotes_convert_rs/ |
max_upload_size | |
id | 674057 |
size | 89,315 |
cargo add json_keyquotes_convert
use json_keyquotes_convert::{JsonKeyQuoteConverter, Quotes};
let json = JsonKeyQuoteConverter::new("{key: \"va\nl\"}", Quotes::default())
.add_key_quotes().escape_ctrlchars().json();
// JSON string will now be: {\"key\": \"va\\nl\"}
// Raw JSON will now be: {"key": "va\nl"}
use json_keyquotes_convert::{json_key_quote_utils, Quotes};
let json_added = json_key_quote_utils::json_add_key_quotes("{key: \"va\nl\"}", Quotes::default());
let json_escaped = json_key_quote_utils::json_escape_ctrlchars(&json_added);
// JSON string will now be: {\"key\": \"va\\nl\"}
// Raw JSON will now be: {"key": "va\nl"}
Great | Good | Unsupported |
---|---|---|
:heavy_check_mark: | :white_check_mark: | :x: |
Automatically | Configurable | Unsupported |
** Any unlisted features might be unsupported. **
<U+0020>(Space)
<U+0020>(Space)
The JSON data-format as shown in the tests shares some similarities with both JSON5 and HJSON. Unfortunately, these data-formats differ enough that it can not be parsed by the JSON5 and HJSON parsers, which is why this crate was made.
The JSON data-format as shown in the tests is used by the following software:
Regex: Copyright (c) 2014 The Rust Project Developers. Licensed under the MIT license, see LICENSES.MIT for details. The notice can be found at Regex-NOTICE. Website: https://github.com/rust-lang/regex.
once_cell: Licensed under the MIT license, see LICENSES.MIT for details. Website: https://github.com/matklad/once_cell.