Jaxon v2.0.2 Jaxon.Stream View Source

Link to this section Summary

Functions

Transform a binary stream into a stream of events.

Query all values of an array

Link to this section Types

Link to this type

event_stream()

View Source
event_stream() :: Enumerable.t()
Link to this type

term_stream()

View Source
term_stream() :: Enumerable.t()

Link to this section Functions

Link to this function

from_enumerable(bin_stream)

View Source
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"}]]

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"]

See Jaxon.Decoders.Values.values/1.