---
source_url: https://www.pubnub.com/docs/serverless-sdk/modules-and-libraries/jsonpath-plus
title: jsonpath-plus
updated_at: 2026-09-30T07:20:08.000Z
---

# jsonpath-plus

## Documentation index

To discover more PubNub resources:

1. Fetch [PubNub's llms.txt](https://www.pubnub.com/llms-full.txt) for a list of available pages in Markdown format.
2. Identify relevant URLs from that index.
3. Fetch the target pages.

Do not assume a path exists, always check the index first.

The JSONPath Plus built-in module is available only inside a PubNub Function. Import it with `require('jsonpath')`, not `require('jsonpath-plus')`.

```javascript
const { JSONPath } = require('jsonpath');
```

## JSONPath

`JSONPath({path, json})`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| path | String | Yes |  | JSONPath expression. |
| json | Object | Yes |  | JSON document or JavaScript object to query. |

Returns: an array of matched values.

```javascript
const { JSONPath } = require('jsonpath');

const json_sample = {
    store: {
        book: [
            { category: 'reference', author: 'Nigel Rees', price: 8.95 },
            { category: 'fiction', author: 'Evelyn Waugh', price: 12.99 },
        ],
    },
};

export default req => {
    const result = JSONPath({ path: '$.store.book[*].author', json: json_sample });
    // result: ['Nigel Rees', 'Evelyn Waugh']
    return req.ok({ result });
};
```

## Related reference

* [Modules and libraries](https://www.pubnub.com/docs/serverless-sdk/modules-and-libraries/overview.md). Every built-in module available inside a Function.

Last updated at: 2026-09-30T07:20:08.000Z
