Skip to content
No description, website, or topics provided.
Other Objective-J OpenEdge ABL Logos Rebol
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/JSON
t
.gitignore
META6.json
README.md

README.md

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}}
]
You can’t perform that action at this time.