Strongly-typed AST types for JSON, auto-generated from
tree-sitter-json's node-types.json.
This crate is generated by treesitter-types and is
automatically kept up to date when a new version of the grammar crate is released.
These types have been tested by parsing the SchemaStore source code.
See the Tree-sitter project for more information about the underlying parser framework.
Example
use *;
// A small JSON document.
let src = b"\
{
\"name\": \"hello\",
\"version\": 42
}
";
// Parse the source with tree-sitter and convert into typed AST.
let mut parser = new;
parser.set_language.unwrap;
let tree = parser.parse.unwrap;
let document = from_node.unwrap;
// The document contains one top-level value: a JSON object.
assert_eq!;
let Object = &document.children else ;
// The object has two key-value pairs.
assert_eq!;
// First pair: "name" => "hello".
let first_pair = &object.children;
assert_eq!;
// Second pair: "version" => 42.
let second_pair = &object.children;
let Number = &second_pair.value else ;
assert_eq!;