Grab a Value Buried in Nested JSON

Roadblock: the API returns a huge nested payload and the visual mapper can't reach data.items[0].price.amount. Two lines get exactly what you need — safely.

The Snippet

const data = JSON.parse(input.payload);
// Optional chaining: never crashes if a level is missing
const amount = data?.items?.[0]?.price?.amount ?? 0;
return { amount };

Implementation Steps

  1. Parse the JSON in a Make code module (or Zapier Code step)
  2. Use optional chaining so missing fields don't crash the run

All templates