jsonpath in elixir through nodejs
made possible thanks to reverly labs' library https://hex.pm/packages/nodejs
- Installation of nodejs
- Add pathfinder to your mix.exs
def deps do
[
{:pathfinder, "~> 0.1.0"}
]
end
- Run
mix deps.get
- Copy NodeJS files
cp -a deps/pathfinder/node ./
- Install NodeJS dependencies
cd node && npm install
⇒ iex -S mix
Erlang/OTP 22 [erts-10.4.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]
Interactive Elixir (1.8.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Pathfinder.query("{\"test\": 1}","$..test")
{:ok, [1]}
iex(2)>
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/pathfinder.
- .query/2
- .query/3
- .paths
- .nodes
- .parse
- .parent
- .value
- .stringify