Exjpet (exjpet v0.3.0)

Documentation for Exjpet.

Examples

with (default) Poison decoder / encoder ...

iex> epm = Exjpet.compile("[1, *, (?<cap>{})]")
iex> json = Exjpet.decode(~s([1, 2, {"a": 42}]), :poison)
iex> Exjpet.run(json, epm)
{true, %{"cap" => [%{"a" => 42}]}}

... or with Jason as decoder / encoder

iex> epm = Exjpet.compile("[1, *, (?<cap>{})]", :jason)
iex> json = Exjpet.decode(~s([1, 2, {"a": 42}]), :jason)
iex> Exjpet.run(json, epm)
{true, %{"cap" => [%{"a" => 42}]}}

Link to this section Summary

Functions

See :ejpet.backend/1.

Compile expr with Poison as JSON codec.

See :ejpet.compile/2.

See :ejpet.compile/3.

See :ejpet.compile/4.

Decode string str using Poison.

See :ejpet.decode/2.

See :ejpet.empty_capture_set/0.

See :ejpet.empty_capture_set/1.

Encode JSON document json using Poison.

See :ejpet.encode/2.

See :ejpet.generator/1.

See :ejpet.get_capture/2.

See :ejpet.get_capture/3.

See :ejpet.get_captures/1.

See :ejpet.get_status/1.

See :ejpet.match/2.

See :ejpet.match/3.

See :ejpet.match/4.

See :ejpet.run/2.

See :ejpet.run/3.

Link to this section Functions

See :ejpet.backend/1.

Compile expr with Poison as JSON codec.

Same as Exjpet.compile(expr, :poison)

iex> epm = Exjpet.compile "[*]"
iex> Exjpet.backend epm
:poison
Link to this function

compile(arg1, arg2)

See :ejpet.compile/2.

Link to this function

compile(arg1, arg2, arg3)

See :ejpet.compile/3.

Link to this function

compile(arg1, arg2, arg3, arg4)

See :ejpet.compile/4.

Decode string str using Poison.

Same as Exjpet.decode(str, :poison)

iex> Exjpet.decode ~s({"foo": 42})
%{"foo" => 42}
Link to this function

decode(arg1, arg2)

See :ejpet.decode/2.

Link to this function

empty_capture_set()

See :ejpet.empty_capture_set/0.

Link to this function

empty_capture_set(arg1)

See :ejpet.empty_capture_set/1.

Encode JSON document json using Poison.

Same as Exjpet.encode(json, :poison)

iex> Exjpet.encode %{foo: 42}
"{\"foo\":42}"
Link to this function

encode(arg1, arg2)

See :ejpet.encode/2.

Link to this function

generator(arg1)

See :ejpet.generator/1.

Link to this function

get_capture(arg1, arg2)

See :ejpet.get_capture/2.

Link to this function

get_capture(arg1, arg2, arg3)

See :ejpet.get_capture/3.

Link to this function

get_captures(arg1)

See :ejpet.get_captures/1.

Link to this function

get_status(arg1)

See :ejpet.get_status/1.

Link to this function

match(arg1, arg2)

See :ejpet.match/2.

Link to this function

match(arg1, arg2, arg3)

See :ejpet.match/3.

Link to this function

match(arg1, arg2, arg3, arg4)

See :ejpet.match/4.

Link to this function

run(arg1, arg2)

See :ejpet.run/2.

Link to this function

run(arg1, arg2, arg3)

See :ejpet.run/3.