How sivaosorg/fj works
Main Components
a) Core Processing Components:
• JSON Parser Engine
• Path Resolution System
• Query Processing System
• Transformer Pipeline
• Type System Handler
b) Supporting Components:
• Context Management
• Value Extraction System
[Input Layer]
• ▼
[Parser Engine] ◄────────────► [Type System Handler]
• ▼ ▼
[Path Resolution] ◄───────► [Context Management]
• ▼ ▼
[Query Processor] ◄───────► [Value Extraction]
• ▼
[Transformer Pipeline]
• ▼
[Output Formatting]
Component Details
a) Input Layer:
• Accepts both string and []byte JSON inputs
• Handles JSON Lines format
• Direct file reading capabilities
b) Parser Engine:
• Fast, zero-allocation JSON parsing
• Streaming capabilities
• Direct byte manipulation
• Error handling and validation
c) Path Resolution System:
• Dot notation parser
• Wildcard handling
• Array index resolution
• Query syntax parsing
d) Query Processing:
• Comparison operators (==, !=, <, <=, >, >=)
• Pattern matching (%, !%)
• Boolean evaluation (~true, ~false, ~null, ~*)
• Array filtering
e) Transformer Pipeline:
• Built-in transformers (@trim, @pretty, @minify, etc.)
• Custom transformer support
• Chaining capability
• Configuration options
f) Type System:
• JSON type handling (string, number, boolean, null)
• Type conversion utilities
• Array and object handling
• Custom type implementations
Flow Indicators
→ Primary data flow
⟷ Bi-directional communication
⤷ Optional path
● Connection point
Implementation Notes
• The modular design allowing for easy extension
• The clear separation between parsing, querying, and transformation
• The efficient handling of different input types
• The comprehensive type system
• The flexible transformation pipeline
Key Relationships
• Parser Engine ↔ Type System: Type inference and validation
• Path Resolution ↔ Query Processor: Query execution and filtering
• Context Management ↔ Value Extraction: Data access and manipulation
• Transformer Pipeline ↔ Output Formatting: Data transformation and presentation
This system design should be drawn with clear boundaries between components while showing their interactions, emphasizing the package's focus on performance and flexibility in JSON manipulation.