Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mojo::json::pointer(3pm) [debian man page]

Mojo::JSON::Pointer(3pm)				User Contributed Perl Documentation				  Mojo::JSON::Pointer(3pm)

NAME
Mojo::JSON::Pointer - JSON Pointers SYNOPSIS
use Mojo::JSON::Pointer; my $p = Mojo::JSON::Pointer->new; say $p->get({foo => [23, 'bar']}, '/foo/1'); say 'Contains "/foo".' if $p->contains({foo => [23, 'bar']}, '/foo'); DESCRIPTION
Mojo::JSON::Pointer implements JSON Pointers as described in http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer <http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer>. METHODS
"contains" my $success = $p->contains($data, '/foo/1'); Check if data structure contains a value that can be identified with the given JSON Pointer. # True $p->contains({foo => 'bar', baz => [4, 5, 6]}, '/foo'); $p->contains({foo => 'bar', baz => [4, 5, 6]}, '/baz/2'); # False $p->contains({foo => 'bar', baz => [4, 5, 6]}, '/bar'); $p->contains({foo => 'bar', baz => [4, 5, 6]}, '/baz/9'); "get" my $value = $p->get($data, '/foo/bar'); Extract value identified by the given JSON Pointer. # "bar" $p->get({foo => 'bar', baz => [4, 5, 6]}, '/foo'); # "4" $p->get({foo => 'bar', baz => [4, 5, 6]}, '/baz/0'); # "6" $p->get({foo => 'bar', baz => [4, 5, 6]}, '/baz/2'); SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::JSON::Pointer(3pm)

Check Out this Related Man Page

Mojo::JSON(3pm) 					User Contributed Perl Documentation					   Mojo::JSON(3pm)

NAME
Mojo::JSON - Minimalistic JSON SYNOPSIS
use Mojo::JSON; my $json = Mojo::JSON->new; my $bytes = $json->encode({foo => [1, 2], bar => 'hello!'}); my $hash = $json->decode($bytes); DESCRIPTION
Mojo::JSON is a minimalistic and relaxed implementation of RFC 4627. While it is possibly the fastest pure-Perl JSON parser available, you should not use it for validation. It supports normal Perl data types like "Scalar", "Array" reference, "Hash" reference and will try to call the "TO_JSON" method on blessed references, or stringify them if it doesn't exist. [1, -2, 3] -> [1, -2, 3] {"foo": "bar"} -> {foo => 'bar'} Literal names will be translated to and from Mojo::JSON constants or a similar native Perl value. true -> Mojo::JSON->true false -> Mojo::JSON->false null -> undef Decoding UTF-16 (LE/BE) and UTF-32 (LE/BE) will be handled transparently, encoding will only generate UTF-8. The two unicode whitespace characters "u2028" and "u2029" will always be escaped to make JSONP easier. ATTRIBUTES
Mojo::JSON implements the following attributes. "error" my $err = $json->error; $json = $json->error('Oops!'); Parser errors. METHODS
Mojo::JSON inherits all methods from Mojo::Base and implements the following new ones. "decode" my $array = $json->decode($bytes); my $hash = $json->decode($bytes); Decode JSON. "encode" my $bytes = $json->encode({foo => 'bar'}); Encode Perl structure. "false" my $false = Mojo::JSON->false; my $false = $json->false; False value, used because Perl has no native equivalent. "true" my $true = Mojo::JSON->true; my $true = $json->true; True value, used because Perl has no native equivalent. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::JSON(3pm)
Man Page