Navigation

Map API Responses

Learn how to normalize and transform inconsistent API data into a clean structure.

Last updated:

Third-party APIs often return data in formats that don't match your internal data models. DataLensia makes it easy to map these responses to your desired structure.

🚩 The Challenge

An API returns a user object with snake_case keys and string-encoded numbers:

{
  "user_id": "101",
  "full_name": "John Doe",
  "is_pro": "1"
}

You need:

{
  "id": 101,
  "name": "John Doe",
  "isPremium": true
}

🛠️ The Solution

  1. Extract: Paste the JSON response or use the API Fetch Component to pull live data.
  2. Transform: Open the Transform Builder and load your data.
  3. Map:
    • Drag user_id to id and add the To Number operator.
    • Drag full_name to name.
    • Drag is_pro to isPremium and add a Conditional operator ("1" → true).
  4. Load: Export the resulting JSON, or use the Mock API to serve it to your frontend.

🚀 Try it now

Open the Transform Builder and load the "API Normalization" sample to see this in action.