json-gettext 1.6.1

A library for getting text from JSON usually for internationalization.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate serde_json;
extern crate json_gettext;

use json_gettext::Value;

#[test]
fn no_double_quotes() {
    assert_eq!("\"Test\"", serde_json::Value::String("Test".to_string()).to_string());
    assert_eq!("Test", Value::from_json_value(serde_json::Value::String("Test".to_string())).to_string());
}

#[test]
fn escape_double_quotes() {
    assert_eq!("\"Test \\\"abc\\\"\"", serde_json::Value::String("Test \"abc\"".to_string()).to_string());
    assert_eq!("\"Test \\\"abc\\\"\"", Value::from_json_value(serde_json::Value::String("Test \"abc\"".to_string())).to_json());
    assert_eq!("\"Test \\\"abc\\\"\"", Value::from_str("Test \"abc\"").to_json());
}