[][src]Function jsonc_parser::parse_to_ast

pub fn parse_to_ast(
    text: &str,
    options: &ParseOptions
) -> Result<ParseResult, ParseError>

Parses a string containing JSONC to an AST with comments and tokens.

Example

use jsonc_parser::{parse_to_ast, ParseOptions};

let parse_result = parse_to_ast(r#"{ "test": 5 } // test"#, &ParseOptions {
    comments: true, // include comments in result
    tokens: true, // include tokens in result
}).expect("Should parse.");
// ...inspect parse_result for value, tokens, and comments here...