NAME

JSON::Pointer::Marpa - Marpa::R2 based JSON Pointer RFC6901 implementation

SYNOPSIS

use JSON::Pointer::Marpa ();

# $json_document, $json_pointer, and $json_value refer to
# Perl (JSON decoded) values
my $json_value = JSON::Pointer::Marpa->get( $json_document, $json_pointer );

SYNTAX

ABNF syntax of JSON Pointer

json-pointer    = *( "/" reference-token )
reference-token = *( unescaped / escaped )
unescaped       = %x00-2E / %x30-7D / %x7F-10FFFF ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'
escaped         = "~" ( "0" / "1" )               ; representing '~' and '/', respectively
array-index     = %x30 / ( %x31-39 *(%x30-39) )   ; "0", or digits without a leading "0"

ERROR CONDITIONS

This implementation will stop pointer processing, if one of the following error conditions is raised:

  • Handling of '-' array index isn't implemented!"

  • Currently referenced type '%s' isn't a JSON structured type (array or object)!

  • Currently referenced type '%s' isn't a JSON object!"

  • JSON array has been accessed with an index %d that is greater than or equal to the size of the array!

  • JSON object has been accessed with a member '%s' that does not exist!

Other CPAN implementations do not stop processing but return undef for some of these error conditions. This approach is questionable because it does not allow to differentiate a true JSON null value (Perl undef value) from an error condition anymore.

SEE ALSO

AUTHOR

Sven Willenbuecher <sven.willenbuecher@gmx.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2025 by Sven Willenbuecher.

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