Function tsconfig::parse_to_value

source ·
pub fn parse_to_value(json: &str) -> Result<Value>
Expand description

Parse a JSON string into a single serde_json::Value.

The ‘extends’ field will be ignored. Comments and trailing commas are both allowed, although they are not valid JSON.

§Example

use tsconfig::parse_to_value;
use serde_json::Value;


let json = r#"{"compilerOptions": {"jsx": /*here's a comment*/ "react-jsx"},}"#;

let config = parse_to_value(json).unwrap();
assert_eq!(config["compilerOptions"]["jsx"], Value::String("react-jsx".to_string()));