A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/davesnx/query-json below:

davesnx/query-json: Faster, simpler and more portable implementation of `jq` in OCaml

query-json is a faster, simpler and more portable implementation of the jq language in OCaml distributed as a binary, but also distributed as a JavaScript package via js_of_ocaml.

query-json allows you to write small programs to operate on top of json files with a concise syntax.

It was created with mostly two reasons in mind, learning and having fun

Check the content of scripts/install.sh before running anything in your local. Friends don't let friends curl | bash.

curl -sfL https://raw.githubusercontent.com/davesnx/query-json/master/scripts/install.sh | bash
npm install --global @davesnx/query-json
Download zip files from GitHub

I recommend to write the query in single-quotes inside the terminal, since writting JSON requires double-quotes for accessing properties.

NOTE: I have aliased query-json to "q" for short, you can set it in your dotfiles with alias q="query-json".

query-json '.' pokemons.json
cat pokemons.json | query-json '.'
query-json '.' <<< '{ "bulvasur": { "id": 1, "power": 20 } }'
query-json --kind=inline '.' '{ "bulvasur": { "id": 1, "power": 20 } }'
query-json '.' pokemons.json --no-colors

This report is not an exhaustive performance report of both tools, it's a overview for the percieved performance of the user. I don't profile each tool and try to see what are the bootlenecks, since I assume that both tools have the penalty of parsing a JSON file.

Aside from that, query-json doesn't have feature parity with jq which is ok at this point, but jq contains a ton of functionality that query-json misses. Adding the missing operations on query-json won't affect the performance of it, that could not be true for features like "modules", "functions" or "tests".

The report shows that query-json is between 2x and 5x faster than jq in all operations tested and same speed (~1.1x) with huge files (> 100M).

Currently supported feature set Badge Meaning ✅ Implemented ⚠️ Not implemented yet 🔴 Won't implement

Contributions are what make the open source community such an amazing place to be, learn, inspire, and create. Any contributions you make are greatly appreciated. If you have any questions just contact me @twitter or email dsnxmoreno at gmail dot com.

I usually hang out at discord.gg/reasonml or x.com/davesnx so feel free to ask anything.

Requirements: opam

git clone https://github.com/davesnx/query-json
cd query-json
make init # creates opam switch, installs ocaml deps and npm deps
make dev-core # compiles query-json "core" only
make test # runs unit tests and snapshots tests
dune exec query-json # Run binary

Running the playground

# In different terminals
make dev # compiles all packages "query-json" "query-json-s" and "query-json-playground", and runs the bundler
make web-dev # Runs bundler

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4