# Ingesting JSON Event Properties JSON Remapping

The **JSON Ingest Remapping** feature enables customers to extract deeply nested JSON fields and promote them to the top level during ingestion into the Real-Time pipeline.

This makes those fields directly accessible in Real-Time workflows — including T**riggers, Personalization, Reactor, and Plazma** — without requiring upstream flattening, Lambda functions, or custom ETL.

# When to Use

Use JSON Ingest Remapping when:

* You have nested JSON events coming into the Real-Time ingestion pipeline.
* You want to use inner fields (e.g. user.id, order.details.total) in segmentation, triggering, or personalization rules.
* You want to avoid the cost and complexity of flattening data upstream or modifying source systems.


# How It Works

You define a **mapping rule** that specifies:

* The source field path (within the nested JSON)
* The name of the new top-level field that will hold the extracted value


These rules are configured via the **Real-Time API** and are applied per database.table.

Once applied, any incoming event that matches the table and contains the nested path will have the remapped field injected as a top-level property at ingest time.

## Setup Steps

1. Enable the Account (One-Time)


This feature is gated behind a flag. Please contact your Customer Success Manager or Treasure Data Support to have it enabled for your account.

1. Configure Mapping via API


Use the PUT /event_property_remappings endpoint:

- Example Request:



```bash
curl -X PUT 'https://realtime-api.treasuredata.com/event_property_remappings' \
--header 'Authorization: TD1 <your_apikey>' \
--header 'Content-Type: application/json' \
--data '
{
  "event_property_remappings": [
    {
      "database": "demo",
      "table": "customers",
      "source_property_path": "order.details.total",
      "target_property": "order_total"
    }
  ]
}'
```

You can also automate this via Digdag or workflows.

1. Ingest Your Events


Ingest events normally via the [Ingest API] or [Personalization API]. The remapped field will be automatically injected at the top level.

- Example Input:



```json
{
  "order": {
    "details": {
      "total": 149.99
    }
  }
}
```

- Result after remapping:



```json
{
  "order": {
    "details": {
      "total": 149.99
    }
  },
  "order_total": 149.99
}
```