{
  "slug": "transform-and-rename-nested-json-keys",
  "title": "Transform and Rename Nested JSON Keys without Writing Code",
  "metaTitle": "Transform and Rename Nested JSON - RealComposer",
  "metaDescription": "Transform and rename nested json keys without writing code. Map only UI fields from REST API before Frontend / Web parses JSON.",
  "headline": "REST API payloads trimmed for Frontend / Web screens",
  "category": "slimmer",
  "categoryLabel": "Payload Slimmer",
  "urgency": 8,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "REST API"
  ],
  "searchIntentQuery": "transform and rename nested json keys without writing code",
  "directAnswerSummary": "Answer \"transform and rename nested json keys without writing code\" by projecting REST API data server-side: upstream https://jsonplaceholder.typicode.com/users/{{query.userId}}, client sees only mapped keys.",
  "problem": {
    "title": "REST API JSON bloat on Frontend / Web",
    "explanation": "Oversized REST API payloads inflate parse time and mobile data charges for Frontend / Web users.",
    "risks": [
      "Main-thread JSON parse stalls on low-end phones",
      "Accidentally exposing PII fields to the client",
      "Downstream components re-render on unused keys"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Bind vault keys to the Worker",
      "description": "Store API_BEARER_TOKEN in the vault. Frontend / Web never embeds the raw secret, only a revocable rc_live_ client token."
    },
    {
      "stepNumber": 2,
      "title": "Set headers, mapping, and cache TTL",
      "description": "Configure headersTemplate to inject vault secrets, target https://jsonplaceholder.typicode.com/users/{{query.userId}}, and Map only the UI fields in output mapping so clients never download audit or nested blobs."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Call https://realcomposer.com/v1/workspace/transform-and-rename-nested-json-keys with a restricted rc_live_ client token. Frontend / Web never sends upstream secrets.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/transform-and-rename-nested-json-keys', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Transform and Rename Nested JSON Keys without Writing Code",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "upstream",
        "upstreamUrlTemplate": "https://jsonplaceholder.typicode.com/users/{{query.userId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.API_BEARER_TOKEN}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "userId",
          "sourcePath": "id",
          "type": "number",
          "sourceStep": "upstream"
        },
        {
          "targetPath": "name",
          "sourcePath": "name",
          "type": "string",
          "sourceStep": "upstream"
        },
        {
          "targetPath": "email",
          "sourcePath": "email",
          "type": "string",
          "sourceStep": "upstream"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_transfor",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "transform-and-rename-nested-json-keys"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "userId": "sample",
    "name": "sample",
    "email": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/transform-and-rename-nested-json-keys\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Can Frontend / Web call REST API without holding the production key?",
      "answer": "Use scoped tokens where the vendor allows them on transform-and-rename-nested-json-keys. Admin keys stay {{secrets.*}} references only."
    },
    {
      "question": "How do I forward JSON bodies to POST upstreams?",
      "answer": "transform-and-rename-nested-json-keys POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard."
    },
    {
      "question": "What happens if an upstream step times out?",
      "answer": "Allowed origins on the transform-and-rename-nested-json-keys client token restrict which domains may call the edge URL."
    }
  ],
  "relatedRecipeSlugs": [
    "cache-third-party-api-at-edge",
    "best-api-gateway-react-native",
    "plaid-api-proxy-flutter"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/transform-and-rename-nested-json-keys",
    "markdown": "https://realcomposer.com/recipes/transform-and-rename-nested-json-keys.md",
    "json": "https://realcomposer.com/recipes/transform-and-rename-nested-json-keys.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=transform-and-rename-nested-json-keys&via=agent"
  }
}