json_path 0.0.1 copy "json_path: ^0.0.1" to clipboard
json_path: ^0.0.1 copied to clipboard

outdated

JSONPath for Dart. JSONPath is XPath for JSON. It is a path in a JSON document.

example/main.dart

import 'dart:convert';

import 'package:json_path/json_path.dart';

void main() {
  final json = jsonDecode('''
{
  "store": {
    "book": [
      {
        "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      },
      {
        "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
      },
      {
        "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
      },
      {
        "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95
    }
  }
}  
  ''');

  /// The following code will print:
  ///
  /// $['store']['book'][0]['price']:	8.95
  /// $['store']['book'][1]['price']:	12.99
  /// $['store']['book'][2]['price']:	8.99
  /// $['store']['book'][3]['price']:	22.99
  /// $['store']['bicycle']['price']:	19.95
  JsonPath(r'$..price')
      .filter(json)
      .map((result) => '${result.path}:\t${result.value}')
      .forEach(print);
}
94
likes
0
pub points
99%
popularity

Publisher

verified publisherkarapetov.com

JSONPath for Dart. JSONPath is XPath for JSON. It is a path in a JSON document.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on json_path