json_at 1.0.0 json_at: ^1.0.0 copied to clipboard
Dart implementation of RFC 6901 JSON pointer specification
RFC 6901 JSON pointer Dart implementation #
/// Gets [obj] sub-property value located by RFC 6901 JSON [pointer].
/// If type of [obj] is string it will be parsed to JSON object used to search.
/// Returns [Optional] value holder.
Optional<dynamic> jsonAt(dynamic obj, String pointer)
import 'package:json_at/json_at.dart';
const doc = {
'foo': {
'bar': {
'baz': [
{'gaz': 33}
]
}
}
};
final v = jsonAt(doc, '/foo/bar/baz/0/gaz');
expect(v.isPresent, isTrue);
expect(v.value, equals(33));