Name

JSON::Immutable::XS

Description

Fast and simple abstract node-tree based storage with JSON support. Usefull for reading JSON configs, keeping it in the memory and don't worrying about mutability. Has XPath-like interface for data accessing. Easy to use with XS and C/C++ modules.

It use RapidJSON as JSON parser.

Synopsis

use JSON::Immutable::XS;

# you can provide this variable to XS and use it there
my $dict = JSON::Immutable::XS->new('example/dict.json');

# get subnode by path ( any node is JSON::Immutable::XS ref)
my $node = $dict->get( 'path', 2, 'node'); # similar to ->{path}[2]{node}
# get() returns undef on not existed path

my $data = $node->get_value('this', 'is', 'the', 'way'); # data could be an any Perl Sv structure ( scalar, hash or array )

# unless path will found - it'll return undef

# it possible to get keys from node as well
for ( @{$dict->keys()} ){
    ...
}

# use slice to get exactly that you need without unnecessary data ( detail description below )
$dict->slice( 'path' );

# see more features below

Perl interface

AUTHOR

Vladimir Melnichenko melnichenkovv@gmail.com, Crazy Panda, CP Decision LTD GitHub

LICENSE

You may distribute this code under the same terms as RapidJSON itself.