rfc_6901
0.2.1, released a year ago by karapetov.com
Implements RFC 6901 JSON Pointer for reading, writing and removing values in JSON documents.
What it does
Provides a Dart implementation of the JSON Pointer standard (RFC 6901). You can parse or build pointers, then read, write or remove the referenced value in a decoded JSON structure. All operations are pure and return new copies of the document.
AI-written summary of version 0.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to navigate or modify JSON data by pointer paths without adding dependencies
- You want a small, test‑covered library that follows the RFC exactly
Skip it when
- You require full JSONPath or query capabilities
- You need schema validation or complex transformation logic
Strengths
- Zero external dependencies
- Complete RFC 6901 support including the '-' token
- 100 % test coverage and simple API
Weaknesses
- Only handles pointer operations, no JSONPath or advanced querying
- No code generation or async features
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'dart:convert';
import 'package:rfc_6901/rfc_6901.dart';
void main() {
const json = '{"foo": [{"bar": 42}]}';
final doc = jsonDecode(json);
final pointer = JsonPointer('/foo/0/bar');
print(pointer.read(doc)); // 42
final updated = pointer.write(doc, 'banana');
print(updated);
}Alternatives
Packages that do the same job and could replace rfc_6901.
- cv
Helpers to convert Dart objects to/from Map and JSON without code generation.
79Compare - ini
Read and write INI configuration files in pure Dart
44Compare - mutex
Mutual exclusion locks and read-write locks for asynchronous Dart code
50Compare - yaml_writer
A library to write YAML documents supporting Object encoding and dart:convert Converter.
56Compare
Works with
Packages commonly used together with rfc_6901: ones it builds on, ones built on it, and its own family.
- json_pathBuilt on rfc_6901Dart implementation of RFC 9535 JSONPath for querying and manipulating JSON
- json_schemaBuilt on rfc_6901Validate JSON data against JSON Schema drafts in Dart.
- configBuilt on rfc_6901Typed CLI argument and config file parser with env support
- ciderBuilt on rfc_6901CLI tool for Dart package maintenance to automate pubspec.yaml and CHANGELOG.md updates.
- rfc_6902Built on rfc_6901JSON Patch (RFC 6902) implementation for Dart using JSON Pointers.
- selective_disclosure_jwtBuilt on rfc_6901Dart SDK for working with Selective Disclosure JSON Web Tokens (SD-JWT)