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
- Extract: Paste the JSON response or use the API Fetch Component to pull live data.
- Transform: Open the Transform Builder and load your data.
- Map:
- Drag
user_idtoidand add theTo Numberoperator. - Drag
full_nametoname. - Drag
is_protoisPremiumand add aConditionaloperator ("1"→true).
- Drag
- 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.