--- title: "execute json xpath()" slug: "basic-x-path-json" updated: 2026-08-11T11:29:58Z published: 2026-08-11T11:29:58Z canonical: "docs.lobstersoftware.com/basic-x-path-json" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # execute json xpath() This function performs a JSONPath query **b** against an existing JSON object (under key **a**) in the internal cache. For the return value of the function, see parameter **c**. ## Parameters | Parameter | Description | | --- | --- | | a | The key name of the JSON object in the cache. See function [parse json and add to cache()](/v1/docs/en/basic-parse-json)*.* | | b | The JSONPath query. See https://github.com/json-path/JsonPath. | | c | (optional) If *true*, the result of the query is returned as a JSON string. If *false*, the number of elements in the result JSON array or the number of key-value pairs in the result JSON object is returned. Default: false. Alternatively, you can specify the name of a map in this parameter if the result of the query is an object. The key-value pairs of the object are then written into this map. The return value of the function will then be the number of these key-value pairs. See examples below for illustration. | | d | If *true*, exceptions are ignored and an empty string is returned. Default: (== *false*). | | e | (optional) If the JSONPath query returns an array containing special characters, such as the / character, these are escaped with the \ character by default. You can prevent this behaviour with settings this parameter to *true*. Default: *false*. | ## Examples File: ```json {    "store": {        "book": [            {                "category": "reference",                "author": "Nigel Rees",                "title": "Sayings of the Century",                "price": 8.95            },            {                "category": "fiction",                "author": "Evelyn Waugh",                "title": "Sword of Honour",                "price": 12.99            },            {                "category": "fiction",                "author": "Herman Melville",                "title": "Moby Dick",                "isbn": "0-553-21311-3",                "price": 8.99            },            {                "category": "fiction",                "author": "J. R. R. Tolkien",                "title": "The Lord of the Rings",                "isbn": "0-395-19395-8",                "price": 22.99            }        ],        "bicycle": {            "color": "red",            "price": 19.95        }    },    "expensive": 10 } ``` Parameter **b** : *$.store.book[*].author* Parameter **c** *:* *true* Result: *["Nigel Rees","Evelyn Waugh","Herman Melville","J. R. R. Tolkien"]* **NOTE:** The result of the query is an array with 4 elements. Parameter **b** : *$.store.book[*].author* Parameter **c** *:* *false* Result: *4* Parameter **b**: *$.store.book[0].['author','title']* Parameter **c**: *true* Result: *{author=Nigel Rees, title=Sayings of the Century}* **NOTE:** The result of the query is an object with 2 key-value pairs. Parameter **b**: *$.store.book[0].['author','title']* Parameter **c**: *false* Result: *2* Parameter ***b****:* *$.store.book[0].['author','title']* Parameter **c**: *mymap* Result: *2* **NOTE:** The map *mymap* now contains the two key-value pairs *author=Nigel Rees* and *title=Sayings of the Century*. JSON (**J**ava**S**cript **O**bject **N**otation) is a lightweight text format for data exchange. The Lobster Data Platform handles JSON in integration profiles, web resources, and API interfaces. Value resolvers convert JSON data to internal objects and vice versa.