| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.100.1/docs/handbook/_sources/libraries/json_pointer.rst.txt |
.. _library_json_pointer:
json_pointer
The json_pointer library provides predicates for parsing,
generating, and evaluating JSON Pointers as specified by RFC 6901:
chars(List), or
codes(List).Open the `../../apis/library_index.html#json_pointer <../../apis/library_index.html#json_pointer>`__ link in a web browser.
To load all entities in this library, load the loader.lgt file:
::
| ?- logtalk_load(json_pointer(loader)).
To test this library predicates, load the tester.lgt file:
::
| ?- logtalk_load(json_pointer(tester)).
The library defines the json_pointer(_Representation_) parametric
object where _Representation_ can be one of:
atom - reference tokens are represented as atomschars - reference tokens are represented as chars(List)codes - reference tokens are represented as codes(List)
When using the default json_pointer object, reference tokens are
represented as atoms.Parse and evaluate a pointer:
::
| ?- json_pointer::parse(atom('/foo/0'), Pointer),
json_pointer::evaluate(Pointer, {foo-[bar, baz]}, Value).
Pointer = [foo, '0']
Value = bar
yes
Generate a URI fragment representation:
::
| ?- json_pointer::generate_fragment(atom(Fragment), ['a b', 'c/d']).
Fragment = '#/a%20b/c~1d'
yes