PHPackages                             ajayvohra2005/hack-jmespath - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ajayvohra2005/hack-jmespath

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ajayvohra2005/hack-jmespath
===========================

JMESPath search in Hacklang

v1.0.1(4y ago)03MITHack

Since Sep 20Pushed 4y agoCompare

[ Source](https://github.com/ajayvohra2005/hack-jmespath)[ Packagist](https://packagist.org/packages/ajayvohra2005/hack-jmespath)[ Docs](https://github.com/ajayvohra2005/hack-jmespath.git)[ RSS](/packages/ajayvohra2005-hack-jmespath/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

hack-jmespath
=============

[](#hack-jmespath)

Overview
--------

[](#overview)

This [Hack](http://hacklang.org) package allows one to search and extract elements from a JSON document using [JMESPath](http://jmespath.org) query language.

Requirements
------------

[](#requirements)

HHVM 4.123 and above.

Installation
------------

[](#installation)

- Git clone this repository
- Install [composer](https://getcomposer.org/)
- In the root directory of this repository, run the command

    ```
      composer install

    ```

To use this package,

```
    composer require ajayvohra2005/hack-jmespath

```

Running Tests
-------------

[](#running-tests)

After installation, run the following command in the root directory of this repository:

```
    ./vendor/bin/hacktest tests/

```

Example Code
------------

[](#example-code)

Below is a an example for searching a json document using a JMESPath query expression:

```
use namespace HackJmesPath;

function jmespath_example(): void {
  require_once(__DIR__.'/../vendor/autoload.hack');
  \Facebook\AutoloadMap\initialize();

    $json = '{
        "people": [
        {
            "name": "Jeff",
            "age": 33,
            "state": {"name": "up"}
        },
        {
            "name": "Bill",
            "age": 51,
            "state": {"name": "down"}
        },
        {
            "name": "Luna",
            "age": 42,
            "state": {"name": "up"}
        }
        ]
    }';

    $espression = "sort_by(people, &age)[].name";
    $result = HackJmesPath\jmespath_search($espression, $json);

    var_dump($result);
}

```

which produces the following expected output:

```
vec(3) {
  string(4) "Jeff"
  string(4) "Luna"
  string(4) "Bill"
}

```

More Examples
-------------

[](#more-examples)

See [`tests/TreeInterpreterTest.hack`](tests/TreeInterpreterTest.hack) for a complete list of test cases, and more examples.

Decoding JSON Data Types
------------------------

[](#decoding-json-data-types)

JSON 'object' type must be represented by a [Hack dict](https://docs.hhvm.com/hack/arrays-and-collections/introduction). The `stdClass` is not supported for a JSON 'object'. This means if you use the Hack built-in function `json_decode()`, the second argument in the function call must be `true` so that associative arrays are used.

JMESPath Query Language
-----------------------

[](#jmespath-query-language)

Please refer to the in-depth [JMESPath Tutorial](https://jmespath.org/tutorial.html) to learn about JMESPath json query language.

Acknowledgements
----------------

[](#acknowledgements)

The [JMESPath package for PHP](https://github.com/jmespath/jmespath.php) in-part inspired this code. See individual source files for copyright acknowledgement.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1695d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cfef5eb52d2742e88bd534ddfd42add3b7e89dc72bd4ada74e2a8d0e0b335ac0?d=identicon)[ajayvohra2005](/maintainers/ajayvohra2005)

---

Top Contributors

[![ajayvohra2005](https://avatars.githubusercontent.com/u/3870355?v=4)](https://github.com/ajayvohra2005 "ajayvohra2005 (6 commits)")

---

Tags

hackhacklangjmespath

### Embed Badge

![Health badge](/badges/ajayvohra2005-hack-jmespath/health.svg)

```
[![Health](https://phpackages.com/badges/ajayvohra2005-hack-jmespath/health.svg)](https://phpackages.com/packages/ajayvohra2005-hack-jmespath)
```

###  Alternatives

[quizlet/hammock

Hammock is a stand-alone mocking library for Hacklang.

27445.5k](/packages/quizlet-hammock)[hackpack/hackunit

An xUnit testing framework for Hack

622.7k14](/packages/hackpack-hackunit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
