Oak JSON Parser
High-performance incremental JSON parser for the oak ecosystem with flexible configuration, optimized for data processing and analysis.
🎯 Overview
Oak JSON is a robust parser for JSON, designed to handle complete JSON syntax including modern features. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for data processing and analysis.
✨ Features
- Complete JSON Syntax: Supports all JSON features including objects, arrays, primitives
- Full AST Generation: Generates comprehensive Abstract Syntax Trees
- Lexer Support: Built-in tokenization with proper span information
- Error Recovery: Graceful handling of syntax errors with detailed diagnostics
🚀 Quick Start
Basic example:
use ;
use ;
📋 Parsing Examples
Object Parsing
use ;
use ;
let mut session = default;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Array Parsing
use ;
use ;
let mut session = default;
let parser = new;
let source = new;
let result = parser.parse;
println!;
🔧 Advanced Features
Token-Level Parsing
use ;
use ;
let mut session = default;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Error Handling
use ;
use ;
let mut session = default;
let parser = new;
let source = new;
let result = parser.parse;
if let Some = result.result.err else
🏗️ AST Structure
The parser generates a comprehensive AST with the following main structures:
- JsonDocument: Root container for JSON documents
- Object: JSON objects with key-value pairs
- Array: JSON arrays with ordered elements
- Value: JSON values (string, number, boolean, null)
- Property: Object properties with key-value pairs
📊 Performance
- Streaming: Parse large JSON files without loading entirely into memory
- Incremental: Re-parse only changed sections
- Memory Efficient: Smart AST node allocation
- Fast Recovery: Quick error recovery for better processing
🔗 Integration
Oak JSON integrates seamlessly with:
- Data Processing: JSON data extraction and transformation
- Configuration Files: Parsing application configurations
- API Integration: Processing JSON API responses
- Static Analysis: JSON schema validation and analysis
- Code Generation: Generating code from JSON schemas
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete JSON document parsing
- Object and array analysis
- Data transformation
- Integration with development workflows
🤝 Contributing
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.