Warpath.query
You're seeing just the function
query
, go back to Warpath module for more information.
Specs
Query data for the given expression.
Example
iex> data_structure = %{"name" => "Warpath"}
...> Warpath.query(data_structure, "$.name")
{:ok, "Warpath"}
iex> raw_json = ~s/{"name": "Warpath"}/
...> Warpath.query(raw_json, "$.name")
{:ok, "Warpath"}
iex> #Pass a compiled expression as selector
...> {:ok, expression} = Warpath.Expression.compile("$.autobots[0]")
...> Warpath.query(%{"autobots" => ["Optimus Prime", "Warpath"]}, expression)
{:ok, "Optimus Prime"}
Options:
result_type:
:value
- return the value of evaluated expression -default
:path
- return the bracketfiy path string representation of evaluated expression instead of it's value:value_path
- return both value and bracketify path string.:path_tokens
- return the path tokens instead of it string representation, seeWarpath.Element.Path
.:value_path_tokens
- return both value and path tokens.