---
schema_version: "1"
id: 8f802e05895cd4d452d42d8edfe3ac205b4cabd5dafd4be29eae531494da8cac
title: json Functions
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/atf/guides/atf-rules-json-functions.md
canonical_url: https://developer.salesforce.com/docs/analytics/app-template-framework/guide/atf-rules-json-functions.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d0ab78e1a1ec06f715231f289fbf8759c778ece15e14ba359eed99735417c14d
products:
  - App Template Framework
  - analytics
---
# `json` Functions

Use `json` functions in rules to manipulate JSON at runtime. For example, find all the JSON paths in a dashboard that have a link widget and update the links at runtime.

## `searchPaths`

Parameters: `String jsonPath`

Returns: `Collection<String>`

Recursive: Not supported

Description: Searches the current JSON document and returns matching fully qualified JSON paths. If no results are found, returns an empty array. If more than one item is found, returns an array of JSON paths.

### Example

```json
{
    "searchPaths": "${json:searchPaths('$.state.widget..[?(@.type in [\"link\"])]')}"
}
```

run on a dashboard returns all JSON paths in the dashboard with link widgets:

```json
{
    "searchPaths": ["$['state']['widgets']['link3']", "$['state']['widgets']['link4']", "$['state']['widgets']['link1']", "$['state']['widgets']['link2']" ]
}
```

These paths can be used to make runtime updates to the links in the dashboard.

## `searchValues`

Parameters: `String jsonPath`

Returns: `Collection<Object>`

Recursive: Not supported

Description: Searches the current JSON document and returns values of the matching nodes. If no results are found, returns an empty array. If more than one item is found, returns an array of objects. This function throws an error when called outside rules execution.

### Example

```json
{
    "searchValues": "${json:searchValues('$.path.to.json.object')}"
}
```



## `toJsonObject`

Parameters: `Object object`

Returns: `Object`

Recursive: Not supported

Description: Converts a string to a JSON object

### Example

```json
{
    "jsonObject": "${json:toJsonObject('{\"type\" : \"fruit\",\"color\" : \"red\"}')}"
}
```

Returns
```json
{
    "jsonObject": {
        "type" : "fruit",
        "color" : "red"
    }
}
```
