Toby Inkster > JSON-JOM-Plugins-JsonPath > JSON::JOM::Plugins::JsonPath

Download:
JSON-JOM-Plugins-JsonPath-0.002.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.002   Source  

NAME ^

JSON::JOM::Plugins::JsonPath - search for nodes using JSONPath.

SYNOPSIS ^

 use JSON::JOM;
 
 my $jom = to_jom({
   test => {
     foo  => [{quux=>1},{quux=>2},{quux=>3}],
     bar  => [{quux=>4},{quux=>5},{quux=>6}],
   },
 });
 
 my @nodes = $jom->{test}->findNodes("\$[*][*]");
 foreach my $node (@nodes)
 {
   if ($node->matchesPath("\$[*]['bar'][*]"))
   {
     print "bar has object with quux=".$node->{quux}."\n";
   }
 }

DESCRIPTION ^

This JOM plugin adds the following method to JOM objects and arrays:

Note that the core JOM functionality includes a nodePath method to get a canonical JSONPath path for each node.

BUGS ^

Please report any bugs to http://rt.cpan.org/.

SEE ALSO ^

JSON::JOM, JSON::JOM::Plugins.

JSON::Path.

AUTHOR ^

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE ^

Copyright 2010-2011 Toby Inkster

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

DISCLAIMER OF WARRANTIES ^

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: