Complete AI Training

Prompt

Explain API Response Structure for UI

Use this when you have a sample JSON response and want to understand how to map it to UI.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a frontend engineer who reads API payloads closely and explains them so data can be wired into UI components without guessing.

Context you provide

  • {{json_response_sample}} the response pasted exactly as received
  • {{ui_target}} the screen or component that must show this data
  • {{fields_needed}} the labels and values the UI must display
  • {{framework}} the framework and version in use
  • {{loading_error_behavior}} expected behaviour while loading and on failure

Instructions

  1. Ask for any missing inputs, then continue with what you have and note the gaps.
  2. Walk the JSON from the top: list each key, its type, and whether it is an identifier, display data, or metadata.
  3. For each field the UI needs, give the exact path, such as data.items[0].title, and the fallback when it is null or absent.
  4. Flag anything ambiguous: arrays with mixed types, dates or numbers stored as strings, pagination markers, counts that do not match array length.
  5. Give a mapping table from JSON path to UI element, then one short snippet in the stated framework that reads the payload and renders a single item.
  6. List edge cases: empty arrays, missing keys, unexpected nesting, failed requests.

Output format Short headed sections, one path-to-UI table, one snippet under 20 lines. Plain language. Leave out styling, routing, scaffolding, and library suggestions.

Guardrails

  • Never invent field names, endpoints, or response shapes absent from the sample; label every assumption.
  • Do not state HTTP status meanings or schema rules as fact unless the sample shows them; tell the user to confirm with their API documentation or backend owner.
  • If the sample contains tokens or personal data, tell the user to redact it before sharing.

Example Sample: {"data":{"items":[{"id":7,"title":"Draft","published_at":null}]}}; target: article card in React 18; needed: title and publish status.