JSON::Path

Implementation of the jsonpath for perl6

JSON::Path

A pure perl JSON path implementation for perl6.

Implementation

This module implements most of the spec outlined here

use JSON::Path;

my $jpath = '$.options';
my $json  = from-json( '{ "options": { "is-rad": true } }' );

# Get results from the json:
my $results = filter-json($jpath, $json);

#`[
[ { "is-rad" => True } ]
]

# Get paths from the json:
my $results = filter-json($jpath, $json, :want-path);

#`[
[ "options" ]
]

# Alter the json:
my $modifier = sub ($val is rw) {
  $val = !$val;
};
filter-json($jpath, $json, :assign($modifier));

#`[
$json before: {"options":{"is-rad":true}}
 $json after: {"options":{"is-rad":false}}
]

JSON::Path v0.2

Implementation of the jsonpath for perl6

Authors

  • Tony O'Dell

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • JSON::Path
  • JSON::Path::Grammar

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.