tiny_json/
lib.rs

1mod node;
2mod token;
3mod util;
4mod parser;
5mod expression;
6mod walk;
7mod stringifier;
8
9use crate::stringifier::Stringifier;
10use crate::parser::Parser;
11
12// re-export
13pub use crate::node::{Node, NodeType, NodeChild};
14pub use crate::walk::walk;
15pub use crate::token::{Token, TokenType};
16
17/// 序列化 JSON
18pub fn stringify(node: &Node, indent: u32) -> String {
19    let mut stringifier = Stringifier::new(indent);
20    stringifier.stringify(&node)
21}
22
23/// 解析 JSON
24pub fn parse(input: &str) -> Node {
25    Parser::parse(input)
26}
27