{"id":15066810,"url":"https://github.com/discoveryjs/jora","last_synced_at":"2026-05-24T00:04:33.845Z","repository":{"id":36599986,"uuid":"141193490","full_name":"discoveryjs/jora","owner":"discoveryjs","description":"JavaScript object query engine","archived":false,"fork":false,"pushed_at":"2025-05-04T22:14:27.000Z","size":9483,"stargazers_count":166,"open_issues_count":9,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-13T13:26:26.717Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://discoveryjs.github.io/jora/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/discoveryjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-16T20:55:39.000Z","updated_at":"2025-05-04T22:13:55.000Z","dependencies_parsed_at":"2023-09-21T19:36:43.060Z","dependency_job_id":"a741c7ea-d516-4659-ab04-931895dedca1","html_url":"https://github.com/discoveryjs/jora","commit_stats":{"total_commits":544,"total_committers":6,"mean_commits":90.66666666666667,"dds":"0.014705882352941124","last_synced_commit":"e488f6148dadce66d6d1ac2a1f7c682e3da43000"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discoveryjs%2Fjora","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discoveryjs%2Fjora/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discoveryjs%2Fjora/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discoveryjs%2Fjora/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/discoveryjs","download_url":"https://codeload.github.com/discoveryjs/jora/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355334,"owners_count":22057354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-25T01:12:30.979Z","updated_at":"2026-05-24T00:04:33.814Z","avatar_url":"https://github.com/discoveryjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jora\n\n[![NPM version](https://img.shields.io/npm/v/jora.svg)](https://www.npmjs.com/package/jora)\n[![Build Status](https://github.com/discoveryjs/jora/actions/workflows/build.yml/badge.svg)](https://github.com/discoveryjs/jora/actions/workflows/build.yml)\n[![Coverage Status](https://coveralls.io/repos/github/discoveryjs/jora/badge.svg?branch=master)](https://coveralls.io/github/discoveryjs/jora?branch=master)\n[![Twitter](https://badgen.net/badge/follow/@js_discovery?icon=twitter)](https://twitter.com/js_discovery)\n\nJavaScript object query language, and a library to process and perform Jora queries on data.\n\n\u003e STATUS: Jora is stable, but syntax may change in next releases. Still very much work in progress ([ideas and thoughts](https://gist.github.com/lahmatiy/d5af7a987e9548e80eae5f46e6edc931)). \n\nFeatures:\n\n- Tolerant to data stucture queries (e.g. just returns *nothing* for paths that not reachable)\n- Compact syntax for common tasks\n- Aggregate values across arrays and eliminate duplicates by default\n- Stat collecting mode (powers suggestions)\n- Tolerant parsing mode (useful to provide suggestions for query in an editor)\n- Extensible DSL on query build by custom method list\n\nRelated projects:\n\n- [Discovery](https://github.com/discoveryjs/discovery) – Uses jora as core fuctionality to transform a data flow for views and query data for reports\n- [JsonDiscovery](https://github.com/discoveryjs/browser-extension-json-discovery) – a browser’s extension based on Discovery for viewing JSON documents, available for [Chrome](https://chrome.google.com/webstore/detail/jsondiscovery/pamhglogfolfbmlpnenhpeholpnlcclo) and [Firefox](https://addons.mozilla.org/en-GB/firefox/addon/jsondiscovery/) (read more [Changing a way we’re viewing JSON in a browser](https://medium.com/@rdvornov/changing-a-way-were-viewing-json-in-a-browser-51eda9103fa2))\n- [jora-cli](https://github.com/discoveryjs/jora-cli) – Command line interface for transforming data using Jora\n- [Jora sandbox](https://discoveryjs.github.io/jora-sandbox/) – A Web interface where you can play with jora syntax or transform some JSON with zero setup\n\nTable of content:\n\n\u003c!-- TOC depthfrom:2 --\u003e\n\n- [Query syntax overview](#query-syntax-overview)\n    - [Comments](#comments)\n    - [Expressions](#expressions)\n    - [Literals](#literals)\n    - [Operators](#operators)\n    - [Dot, bracket and slice notations](#dot-bracket-and-slice-notations)\n    - [Methods and functions](#methods-and-functions)\n    - [Mapping and filtering](#mapping-and-filtering)\n    - [Variables](#variables)\n- [NPM package](#npm-package)\n    - [Install \u0026 import](#install--import)\n    - [API](#api)\n    - [Quick demo](#quick-demo)\n\n\u003c!-- /TOC --\u003e\n\n## Query syntax overview\n\nJora is a query language designed for JSON-like data structures. It extends [JSON5](https://json5.org/) and shares many similarities with JavaScript.\n\nSee [Docs \u0026 playground](https://discoveryjs.github.io/jora/).\n\n### Comments\n\n```js\n// single-line comment\n/* multi-line\ncomment */\n```\n\n### Expressions\n\nJora expressions are the building blocks of Jora queries. Expressions can include comments, literals, operators, functions, and variables.\n\n### Literals\n\nJora supports literals, which include:\n\n- Numbers: `42`, `-3.14`, `6.022e23`\n- Strings: `\"hello\"`, `'world'`, \u003ccode\u003e\\`template${yes}\\`\u003c/code\u003e, `\"\\u{1F600}\"`\n- Booleans: `true`, `false`\n- Regular expressions: `/regexp/flags`\n- Object literals: `{ hello: 'world' }` (see [Object literals](https://discoveryjs.github.io/jora/#article:jora-syntax-object-literal))\n- Array literals: `[1, 2, 3]` (see [Array literals](https://discoveryjs.github.io/jora/#article:jora-syntax-array-literal))\n- Functions: `=\u003e …` (see [Functions](https://discoveryjs.github.io/jora/#article:jora-syntax-functions))\n- Keywords: `NaN`, `Infinity`, `null` and `undefined`\n    \nSee [Literals](https://discoveryjs.github.io/jora/#article:jora-syntax-literals)\n\n### Operators\n\nJora supports most JavaScript operators, including:\n\n- Arithmetic: `+`, `-`, `*`, `/`, `%`\n- Comparison: `=`, `!=`, `\u003c`, `\u003c=`, `\u003e`, `\u003e=`, `~=`\n- Logical: `and`, `or`, `not` (alias `no`), `??`, `is`, `in`, `not in`, `has`, `has no`\n- Ternary: `?:`\n- Grouing: `( )`\n- Pipeline: `|`\n\nSee [Operators](https://discoveryjs.github.io/jora/#article:jora-syntax-operators)\n\n### Dot, bracket and slice notations\n\nJora provides notations for accessing properties and elements: dot, bracket and slice notations. Dot notation is similar to JavaScript's property access notation, using a period followed by the property name (e.g., `$.propertyName`). Bracket notation encloses the property name or index within square brackets (e.g., `$['propertyName']` or `$[0]`), it's also possible to use functions to choose. Slice notation provides a concise syntax to slice elements with optional step (`array[5:10:2]` selects each odd element from 5th to 10th indecies).\n\n- [Dot notation](https://discoveryjs.github.io/jora/#article:jora-syntax-dot-notation)\n- [Bracket notation](https://discoveryjs.github.io/jora/#article:jora-syntax-bracket-notation)\n- [Slice notation](https://discoveryjs.github.io/jora/#article:jora-syntax-slice-notation)\n\n### Methods and functions\n\nJora provides a rich set of built-in methods for manipulating data, such as `map()`, `filter()`, `group()`, `sort()`, `reduce()`, and many others. You can also define custom functions using the `=\u003e` arrow function syntax, and use them as a method.\n\n- [Functions](https://discoveryjs.github.io/jora/#article:jora-syntax-functions)\n- [Methods](https://discoveryjs.github.io/jora/#article:jora-syntax-methods)\n- [Built-in methods](https://discoveryjs.github.io/jora/#article:jora-syntax-methods-builtin)\n- [Grouping](https://discoveryjs.github.io/jora/#article:jora-syntax-group): `group()` method\n- [Sorting](https://discoveryjs.github.io/jora/#article:jora-syntax-sort): `sort()` method\n\n### Mapping and filtering\n\nJora has a concise syntax for mapping and filtering. The `map(fn)` method is equivalent to `.(fn())`, while the `filter(fn)` method is equivalent to `.[fn()]`.\n\n- [Filtering](https://discoveryjs.github.io/jora/#article:jora-syntax-filter): `.[…]` and `filter()` method\n- [Mapping](https://discoveryjs.github.io/jora/#article:jora-syntax-map): `.(…)` and `map()` method\n- [Recursive mapping](https://discoveryjs.github.io/jora/#article:jora-syntax-recursive-map): `..(…)`\n\n### Variables\n\nVariables in Jora are helpful for storing intermediate results or simplifying complex expressions. To define a variable, use the `$variableName: expression;` syntax.\n\nSee [Variables](https://discoveryjs.github.io/jora/#article:jora-syntax-variables)\n\n## NPM package\n\n### Install \u0026 import\n\nInstall with npm:\n\n```\nnpm install jora\n```\n\nBasic usage:\n\n```js\n// ESM\nimport jora from 'jora';\n\n// CommonJS\nconst jora = require('jora');\n```\n\nBundles are available for use in a browser:\n\n- `dist/jora.js` – minified IIFE with `jora` as global\n```html\n\u003cscript src=\"node_modules/jora/dist/jora.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  jora('query')(data, context);\n\u003c/script\u003e\n```\n\n- `dist/jora.esm.js` – minified ES module\n```html\n\u003cscript type=\"module\"\u003e\n  import jora from 'node_modules/jora/dist/jora.esm.js'\n  // ...\n\u003c/script\u003e\n```\n\nBy default (for short path) a ESM version is exposing. For IIFE version a full path to a bundle should be specified. One of CDN services like `unpkg` or `jsDelivr` can be used:\n\n- `jsDeliver`\n\n    ```html\n    \u003c!-- ESM --\u003e\n    \u003cscript type=\"module\"\u003e\n    import jora from 'https://cdn.jsdelivr.net/npm/jora';\n    \u003c/script\u003e\n    ```\n\n    ```html\n    \u003c!-- IIFE with an export `jora` to global --\u003e\n    \u003cscript src=\"https://cdn.jsdelivr.net/npm/jora/dist/jora.js\"\u003e\u003c/script\u003e\n    ```\n- `unpkg`\n\n    ```html\n    \u003c!-- ESM --\u003e\n    \u003cscript type=\"module\"\u003e\n    import jora from 'https://unpkg.com/jora';\n    \u003c/script\u003e\n    ```\n\n    ```html\n    \u003c!-- IIFE with an export `jora` to global --\u003e\n    \u003cscript src=\"https://unpkg.com/jora/dist/jora.js\"\u003e\u003c/script\u003e\n    ```\n\n### API\n\n```js\nimport jora from 'jora';\n\n// create a query\nconst query = jora('foo.bar');\n\n// perform a query\nconst result = query(data, context);\n```\n\nSee the details in [Jora library API](https://discoveryjs.github.io/jora/#article:api)\n\n### Quick demo\n\nGet npm dependency paths (as a tree) that have packages with more than one version:\n\n```js\nimport jora from 'jora';\nimport { exec } from 'child_process';\n\nfunction printTree() {\n    // see implementation in examples/npm-ls.js\n}\n\nexec('npm ls --all --json', (error, stdout) =\u003e {\n    if (error) {\n        return;\n    }\n\n    const npmTree = JSON.parse(stdout);\n    const depsPathsToMultipleVersionPackages = jora(`\n        $normalizedDeps: =\u003e dependencies.entries().({ name: key, ...value });\n        $multiVersionPackages:\n            ..$normalizedDeps()\n            .group(=\u003ename, =\u003eversion)\n            .({ name: key, versions: value.sort() })\n            .[versions.size() \u003e 1];\n\n        $pathToMultiVersionPackages: =\u003e .($name; {\n            name,\n            version,\n            otherVersions: $multiVersionPackages[=\u003ename=$name].versions - version,\n            dependencies: $normalizedDeps()\n                .$pathToMultiVersionPackages()\n                .[name in $multiVersionPackages.name or dependencies]\n        });\n\n        $pathToMultiVersionPackages()\n    `)(npmTree);\n\n    printTree(depsPathsToMultipleVersionPackages);\n});\n```\n\nExample of output:\n\n```\njora@1.0.0\n├─ c8@7.11.0\n│  ├─ istanbul-lib-report@3.0.0\n│  │  └─ supports-color@7.2.0 [more versions: 8.1.1]\n│  ├─ test-exclude@6.0.0\n│  │  └─ minimatch@3.1.2 [more versions: 3.0.4]\n│  ├─ v8-to-istanbul@8.1.1\n│  │  └─ convert-source-map@1.8.0\n│  │     └─ safe-buffer@5.1.2 [more versions: 5.2.1]\n│  ├─ yargs-parser@20.2.9 [more versions: 20.2.4]\n│  └─ yargs@16.2.0\n│     └─ yargs-parser@20.2.9 [more versions: 20.2.4]\n├─ eslint@8.10.0\n│  ├─ @eslint/eslintrc@1.2.0\n│  │  ├─ ignore@4.0.6 [more versions: 5.2.0]\n│  │  └─ minimatch@3.1.2 [more versions: 3.0.4]\n...\n```\n\nSee more examples in [Complex Jora query examples](https://discoveryjs.github.io/jora/#article:jora-syntax-complex-examples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscoveryjs%2Fjora","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiscoveryjs%2Fjora","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscoveryjs%2Fjora/lists"}