---
title: UNFLATTEN_JSON
url: https://www.tines.com/docs/formulas/functions/unflatten-json/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/docs/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# UNFLATTEN_JSON

*[View on tines.com](https://www.tines.com/docs/formulas/functions/unflatten-json/)*

Transforms a single layer of key/value pairs into a nested JSON structure. Default key separator is a period or full stop (`.`)

**Categories:** Objects

## Syntax

```
UNFLATTEN_JSON(object, [separator])
```

## Examples

### Example 1

Input:

```json
{
  "contact.address.0.city": "Huntsville",
  "contact.address.0.geo.lat": "2.243232",
  "contact.address.0.geo.lon": "1.23123",
  "contact.address.0.state": "NC",
  "contact.address.0.street": "101 3rd St",
  "contact.address.0.type": "home",
  "contact.address.1.city": "city",
  "contact.address.1.geo.lat": "2.243232",
  "contact.address.1.geo.lon": "1.23123",
  "contact.address.1.state": "NC",
  "contact.address.1.street": "15 Main St",
  "contact.address.1.type": "work",
  "contact.id": "557",
  "contact.name": "Jane Smith"
}
```

Formula:

```
UNFLATTEN_JSON(json)
```

Output:

```json
{
  "contact": {
    "address": [
      {
        "city": "Huntsville",
        "geo": {
          "lat": "2.243232",
          "lon": "1.23123"
        },
        "state": "NC",
        "street": "101 3rd St",
        "type": "home"
      },
      {
        "city": "city",
        "geo": {
          "lat": "2.243232",
          "lon": "1.23123"
        },
        "state": "NC",
        "street": "15 Main St",
        "type": "work"
      }
    ],
    "id": "557",
    "name": "Jane Smith"
  }
}
```

## Sample actions

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "3",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "contact.address.0.city": "Huntsville",
          "contact.address.0.geo.lat": "2.243232",
          "contact.address.0.geo.lon": "1.23123",
          "contact.address.0.state": "NC",
          "contact.address.0.street": "101 3rd St",
          "contact.address.0.type": "home",
          "contact.address.1.city": "city",
          "contact.address.1.geo.lat": "2.243232",
          "contact.address.1.geo.lon": "1.23123",
          "contact.address.1.state": "NC",
          "contact.address.1.street": "15 Main St",
          "contact.address.1.type": "work",
          "contact.id": "557",
          "contact.name": "Jane Smith"
        }
      },
      "position": {
        "x": 3090,
        "y": 5415
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "UNFLATTEN_JSON",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "unflatten_json": "=UNFLATTEN_JSON(my_action)"
        }
      },
      "position": {
        "x": 3090,
        "y": 5505
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
