json_events
1.2.2, released 3 years ago by aeb-dev.me
A forward-only event-based package for parsing large JSON files and objects in Dart.
What it does
Processes large JSON files in a forward-only way and emits events based on encountered tokens. Provides mixins like JsonObjectTraverser and JsonArrayTraverser to easily parse streams into typed objects.
AI-written summary of version 1.2.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to parse very large JSON files that would consume too much memory if loaded all at once.
- You are processing JSON from a Stream or String in a forward-only event-driven manner.
Skip it when
- You need simple static JSON serialization with code generation (use built_value or freezed).
- You are working on the web and need to handle very large numbers that exceed JavaScript number compatibility.
Strengths
- Memory efficient for large JSON structures through stream transformation and forward-only processing.
- Provides mixins for clean custom object and array parsing.
Weaknesses
- Web platform has limitations with very big numbers due to JavaScript compatibility.
- Manual setup of traversal logic is required compared to automated code-generation libraries.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Stream<String> s = Stream.value(...);
await for (JsonEvent je in s.transform(const JsonEventDecoder()).flatten()) {
print("Event Type: ${je.type.name} Value: ${je.value}");
}Alternatives
Packages that do the same job and could replace json_events.
- json_object_mapper
Map plain Dart objects to and from JSON without annotations or code generation
39Compare - json_schema
Validate JSON data against JSON Schema drafts in Dart.
63Compare - snowplow_tracker
Flutter package for sending Snowplow analytics events on Android, iOS, and Web.
78Compare - cv
Helpers to convert Dart objects to/from Map and JSON without code generation.
79Compare