Jaxon v2.0.2 Jaxon.Stream View Source
Link to this section Summary
Link to this section Types
Link to this section Functions
Link to this function
from_binary(bin)
View Sourcefrom_binary(String.t()) :: event_stream() | no_return()
Link to this function
from_enumerable(bin_stream)
View Sourcefrom_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"}]]
Link to this function
query(event_stream, query)
View Sourcequery(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"]