JMES (bpxe_jmes v0.6.1) View Source

JMES implements JMESPath, a query language for JSON.

It passes the official compliance tests.

See jmespath.org.

Link to this section Summary

Functions

Evaluates a JMESPath expression against some data.

Link to this section Types

Specs

ast() :: tuple() | atom()

Specs

error() :: {:error, any()}

Specs

expr() :: String.t() | charlist()

Link to this section Functions

Specs

search(ast() | expr(), any()) :: {:ok, any()} | error()

Evaluates a JMESPath expression against some data.

The expression can be a string, a charlist, or an Abstract Syntax Tree (see JMES.Parser.parse/1).

Options

  • underscore: if true, underscore identifiers in the expression (default false)
  • custom_functions: if specified, JMES will attempt to call functions it doesn't know
                    using `call(name, args, options)` in the specificied module
                    (`JMES.Functions.Handler` behaviour)

Examples

iex> JMES.search("[name, age]", %{"name" => "Alice", "age" => 28, "place" => "wonderland"})
{:ok, ["Alice", 28]}
Link to this function

search(expr, data, opts)

View Source

Specs

search(ast(), any(), keyword()) :: {:ok, any()} | error()
search(expr(), any(), keyword()) :: {:ok, any()} | error()