how to consume JSON response from AWS API Gateway - unexpected serialization issues
I'm testing a new approach and I'm wondering if anyone has experience with I'm having trouble consuming a JSON response from an AWS API Gateway endpoint in my Node.js application... The API is configured to return a simple JSON object, but when I try to access the data, I'm working with serialization issues that result in unexpected behavior. Here's what my API Gateway returns: ```json { "statusCode": 200, "body": "{\"message\": \"Hello, World!\"}" } ``` As you can see, the `body` is a JSON string instead of a parsed object, which complicates how I can work with it. I've tried parsing the `body` using `JSON.parse`, but that leads to `SyntaxError: Unexpected token o in JSON at position 1`. My current code to fetch and handle the response looks like this: ```javascript const fetch = require('node-fetch'); async function getData() { const response = await fetch('https://api.example.com/data'); const data = await response.json(); console.log(data); } getData(); ``` When I log `data`, I see that it's an object that includes the original structure from the API Gateway, but the `body` is still a string that needs to be parsed. I tried this: ```javascript const response = await fetch('https://api.example.com/data'); const data = await response.json(); const parsedBody = JSON.parse(data.body); console.log(parsedBody); ``` But this is still giving me the same behavior. I've double-checked that the API Gateway settings are correct and that I'm using the latest version of Node.js (v18.12.1). Is there a specific configuration in the API Gateway that I might be missing, or is there a better approach to handle this JSON serialization scenario? Any help would be greatly appreciated! This is part of a larger web app I'm building. Could this be a known issue?