Parsing Nested JSON From REST APIs in IICS: One Response, Three Clean Linked Tables

  • Category Big Data
  • Reading time 5 MIN READ
  • Published date
  • Views

    Loading

Most modern systems hand over data through a REST API, and the response is JSON. JSON is shaped like a tree: orders hold items, items hold discounts, and some fields are there on Monday and gone on Tuesday. A warehouse wants the opposite: flat rows with clear keys.

The gap between the two is where projects slow down. Someone writes a script to flatten the response. The script drops an order when its item list is empty. It breaks the first time the API adds a field. A year later, only one person knows how it works.

Informatica Intelligent Data Management Cloud (IDMC), still widely known as IICS, can do this with configuration instead of code. If you need to parse nested JSON in IICS, the combination of an Informatica CDI REST V2 connection and the Informatica Hierarchy Parser lets you flatten nested JSON in Informatica without a single line of custom script. This post follows one sample orders API from a first look at the response to three linked tables, with checks that prove every order arrived. It is a design guide for IDMC REST API JSON parsing, and it ends with a table of the pitfalls that most often break nested JSON loads.

1. Read the Response and Agree the Target Model

The temptation is to open the mapping designer first. Don’t. Read a real response and decide what tables you want. Here is a trimmed sample from an orders API, with three orders that behave differently:

{ "orders": [
  { "orderId": "O-1001", "customer": "C-77", "coupon": "DIWALI10",
    "lines": [
      { "lineNo": 1, "sku": "A-12", "qty": 2,
        "discounts": [ { "code": "D5", "amount": 5.00 } ] },
      { "lineNo": 2, "sku": "B-90", "qty": 1, "discounts": [] }
    ] },
  { "orderId": "O-1002", "customer": "C-12", "lines": [] },
  { "orderId": "O-1003", "customer": "C-45",
    "lines": [ { "lineNo": 1, "sku": "A-12", "qty": 4 } ] }
] }

Notice the three edge cases already: an order with an empty lines array (O-1002), an order with a missing optional field (O-1003 has no coupon), and a line with an empty discounts array. A good design handles all three without special code. Agree three tables, one per level of nesting:

Table Key Holds
orders order_id One row per order: customer, coupon, status
order_lines order_id + line_no One row per line: SKU, quantity
line_discounts order_id + line_no + discount_code One row per discount applied to a line

Notice that every child key starts with the parent key. That is what lets you tie a discount back to its order without guessing. Decide now, for each column, its data type and what a missing value should become.

Talk to Informatica Experts

2. Connect to the API

In Cloud Data Integration (CDI), the connection to the API is a REST V2 connection. Put the settings that belong to the API in the connection, and keep them out of the mapping:

Setting What to decide
Endpoint Base URL and path, with environment-specific values parameterised
Authentication Basic, token or OAuth, with secrets held in the connection and not in the mapping
Paging How the API signals more data: page number, offset or a next-page link
Timeouts and retries How long to wait, and how many times to retry before failing the run
Rate limits Calls per minute the API allows, so the job is not blocked for going too fast
Check that your job reads every page, not just the first. A job that reads page one and stops looks perfectly healthy and silently loads a fraction of the data.

Getting this layer right is the foundation of any reliable Informatica Cloud Data Integration REST API pipeline, and it is a standard part of the Informatica consulting services Ksolves delivers.

3. Build the Hierarchy Schema From a Real Response

The Informatica Hierarchy Parser needs a hierarchy schema that describes the shape of the JSON: which fields exist, their types, and which ones repeat. Do not type it from memory. Build it from a real sample that covers every level and every optional field, such as the sample above, with all three behaviours present.

  • Store the schema as a reusable asset so every mapping that reads this API uses the same definition.
  • Keep the sample response next to it, so the schema can be rebuilt when the API changes.
  • Include rare cases in the sample. A field that appears in only 1% of responses still needs to be in the schema, or it is ignored.

4. Parse Each Level Into Its Own Group

The Hierarchy Parser reads the JSON string and returns one output group per level of nesting, each linked to its parent group. For our sample, that gives three groups: orders, lines and discounts. Two rules keep the result safe:

Carry the business key into every child row. The order ID travels down into lines and discounts, so each child row can be tied back to its parent and loaded on its own key.

Join with an outer join. If you join orders to lines with an inner join, order O-1002 disappears because it has no lines. An outer join keeps every parent, and the child columns simply come back empty. The same applies between lines and discounts.

Resist the urge to join everything into one wide table. An order with 3 lines and 2 discounts each would become 6 rows, and an order total would be counted 6 times. Keep the levels separate and join them only when a report needs it.

Get an Integration Quick-Start for Your IDMC REST API Pipelines

What the three tables hold after one run of the sample:

Table Rows Which ones
orders 3 O-1001, O-1002, O-1003 (O-1002 kept despite having no lines)
order_lines 3 O-1001 line 1, O-1001 line 2, O-1003 line 1
line_discounts 1 O-1001 line 1, code D5

5. Load With Keys and Checks

Load in order, parents first: orders, then lines, then discounts. Use update-else-insert on the business key for each table, so running the same response twice leaves the row counts unchanged.

Add two safeguards:

  • An error branch. A Router sends rows that fail validation (a missing order ID, a non-numeric quantity) to an error table with the reason and the order ID, instead of failing the whole run or dropping them.
  • A reconciliation check. Each run compares the number of orders the API returned with the number loaded plus rejected.

In our sample, 3 orders were returned, 3 were loaded and 0 were rejected, so the run reconciles. If the API had returned 3 and only 2 were accounted for, the run would be flagged before anyone sees a wrong report.

The same discipline of validation and reconciliation runs through every ETL/ELT pipeline Ksolves builds, whatever the tool.

6. Paging, Errors and Change

Three things separate a demo from something you can leave running:

  • Failures must be loud. A bad HTTP status code or a half-read response can look like an empty result. Treat anything other than a complete, successful response as a failed run: raise an alert, and make the rerun clean.
  • Paging must be complete. Read until the API says there is no more data, and log the number of pages read. Stay within the API’s rate limits, and use retries with a delay for temporary failures.
  • API changes must have a runbook. When the API adds a field, the schema should be rebuilt from a fresh sample and the new field added to the right table. Write the steps down, so this is a planned task, not a production incident.

7. Test It With the Awkward Cases

Prove the mapping on the responses most likely to break it, and record each result:

Test Expected result
Normal order with lines and discounts Rows land in all three tables with matching keys
Order with an empty lines array Order loads, no child rows, nothing lost
Line with an empty discounts array Line loads, no discount rows
Optional field missing Column is empty, run continues
New field added by the API Ignored safely until the schema is rebuilt
Multiple pages of results Every page is read, counts reconcile
Bad status code or incomplete response Run fails, alert is raised
Same response loaded twice Row counts unchanged

8. Common Pitfalls

Pitfall Symptom Fix
Flattening everything into one wide table Row counts multiply, totals counted more than once One table per level, joined only for reports
Inner join between parent and child Orders with no lines disappear Use an outer join
No parent key in child rows Cannot tie a line back to its order Carry the order ID into every child group
Schema typed from memory Fields missing or ignored after a response change Build it from a real, complete sample
Only the first page read Job is green but data is incomplete Configure paging and log pages read
Bad status treated as empty result Silent failure, no alert Fail the run on anything but a complete response
No reconciliation Nobody can prove every order arrived Compare returned with loaded plus rejected
The lesson repeats from one pitfall to the next. A job can finish green and still be missing data. Check the counts, not the status.

Connect With Ksolves

If your team still flattens REST API responses with hand-written scripts, Ksolves can help you replace them with configured, testable IDMC mappings. Our certified Informatica experts design Informatica CDI REST V2 connections, build hierarchy schemas from real responses, and set up Hierarchy Parser mappings with outer joins, error routing and run-by-run reconciliation, so every record is accounted for. Whether you are starting fresh on IDMC, migrating from PowerCenter, or stabilising pipelines already in production, connect with Ksolves for an integration quick-start. Tell us which APIs you flatten by hand today, and we will show you how a configured IDMC mapping can take their place.

Summary and Recommendation

The sequence we recommend is: read a real response and agree the tables first, connect with paging and retries, build the hierarchy schema from a real sample, parse each level into its own group with outer joins, load with keys, and reconcile every run. Each step is something you can measure, and each one catches what the step before it cannot.

Bottom line: do not write a flattening script until you have tried a configured parse, and do not trust a load until you have seen it handle an empty array on purpose.

Next step: Request an integration quick-start with Ksolves. Tell us which REST APIs your team flattens by hand today, and we will show how a configured IDMC mapping can replace the script.

Environment: Informatica IDMC (Cloud Data Integration). The sample API, data and counts are illustrative. Transformation and option names differ slightly between releases, so re-check them against your own org before publishing.

author image

Author

Anil Kushwaha

Big Data

11+ Years of Data Engineering Experience Leads real-time data ingestion with Apache NiFi and distributed processing with Spark and Hadoop. Specializes in fault-tolerant pipelines, data lakes, and warehouse solutions.

Anil Kushwaha

Author

Anil Kushwaha

Technology Head

11+ Years of Data Engineering Experience Leads real-time data ingestion with Apache NiFi and distributed processing with Spark and Hadoop. Specializes in fault-tolerant pipelines, data lakes, and warehouse solutions.

Global Presence
Follow Us
Copyright 2026© Ksolves.com | All Rights Reserved
Ksolves USP