jsontool
2.1.0, released 3 years ago by infimum.dk
Low‑level tools for reading and writing JSON without creating intermediate Dart objects
What it does
Provides JsonReader, JsonSink, JsonBuilder and JsonProcessor classes that operate directly on JSON strings, bytes or Dart structures. It allows pull‑based parsing, push‑based building and composable transformations.
AI-written summary of version 2.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need fast, memory‑efficient JSON processing in a performance‑critical part of your app
- You want to avoid allocating intermediate List or Map objects when parsing large JSON payloads
Skip it when
- You need code‑generation for JSON models
- You prefer a higher‑level, auto‑generated API like json_serializable
Strengths
- Zero intermediate allocations
- Fine‑grained control over parsing
- Supports both pull and push APIs
- No external dependencies
Weaknesses
- Experimental API
- No code‑generation support
- Requires manual handling of JSON structure
- Limited documentation on advanced use cases
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:jsontool/jsontool.dart';
final reader = JsonReader.fromString('{"a":1}');
while (reader.hasNext) {
final key = reader.expectString();
final value = reader.expectInt();
print('$key: $value');
}
Alternatives
Packages that do the same job and could replace jsontool.
- json_schema
Validate JSON data against JSON Schema drafts in Dart.
63Compare - cv
Helpers to convert Dart objects to/from Map and JSON without code generation.
79Compare - json_object_mapper
Map plain Dart objects to and from JSON without annotations or code generation
39Compare - native_synchronization
Provides low‑level thread synchronization primitives (Mutex, ConditionVariable, Mailbox) via dart:ffi.
50Compare