Jaxon.Stream (Jaxon v2.0.8) View Source
Link to this section Summary
Link to this section Types
Specs
event_stream() :: Enumerable.t()
Specs
term_stream() :: Enumerable.t()
Link to this section Functions
Specs
from_binary(String.t()) :: event_stream() | no_return()
Specs
from_enumerable(Enumerable.t()) :: event_stream()
Transform a binary stream into a stream of events.
iex(1)> Jaxon.Stream.from_enumerable([~s({"jaxon"), ~s(:"rocks","array":[1,2]})]) |> Enum.take(1)
[[:start_object, {:string, "jaxon"}]]
Specs
query(event_stream(), Jaxon.Path.t()) :: term_stream()
Query all values of an array:
iex> ~s({ "numbers": [1,2] })
...> |> Jaxon.Stream.from_binary()
...> |> Jaxon.Stream.query([:root, "numbers", :all])
...> |> Enum.to_list()
[1, 2]
Query an object property:
iex> ~s({ "person": {"name": "Jose"} })
...> |> Jaxon.Stream.from_binary()
...> |> Jaxon.Stream.query([:root, "person", "name"])
...> |> Enum.to_list()
["Jose"]
Specs
values(event_stream()) :: term_stream()