View Source ElasticsearchEx.Ndjson (Elasticsearch_ex v1.8.3)
Provides some helpers to manipulate NDJSON (Newline Delimited JSON).
Summary
Functions
Decodes a binary into a list of term
.
Raises an exception if the JSON decoding fails.
Examples
iex> ElasticsearchEx.Ndjson.decode!("{\"a\":\"b\"}\n{\"c\":\"d\"}\n")
[%{a: :b}, %{c: :d}]
@spec encode!(Enumerable.t()) :: Enumerable.t()
Encodes a list of values into a valid NDJSON.
Raises an exception if the JSON encoding fails.
Examples
iex> ElasticsearchEx.Ndjson.encode!([%{a: :b}, %{c: :d}])
"{\"a\":\"b\"}\n{\"c\":\"d\"}\n"