Skip to content

How to get JSON body if already transformed in a hook? #684

Answered by sholladay
The-LukeZ asked this question in Q&A
Discussion options

You must be logged in to vote

I'm a little unclear on what you are trying to do. Is your goal to "unwrap" the nested data field such that the user can just use json rather than json.data?

If so, then you could return new Response(JSON.stringify(json.data)). Make sure to also pass in the content type header and status as options.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@The-LukeZ
Comment options

Answer selected by The-LukeZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants