Jaxon.Path.encode
You're seeing just the function
encode
, go back to Jaxon.Path module for more information.
Specs
encode(t()) :: {:ok, String.t()} | {:error, Jaxon.EncodeError.t()}
Encoding path expressions:
iex> Jaxon.Path.encode([:root, "test", 0])
{:ok, "$.test[0]"}
iex> Jaxon.Path.encode([:root, "with space", "other", "more space", 0])
{:ok, ~s($["with space"].other["more space"][0])}
How to handle encode errors:
iex> Jaxon.Path.encode([:root, :whoops, "test", 0])
{:error, %Jaxon.EncodeError{message: "`:whoops` is not a valid JSON path segment"}}