Skip to content
Advertisement

How to nest JSON inside “data:”{} object for POST fetch request?

Long time listener, first time caller.

I’ve created a form and sending a fetch request to my database (Xano). My JSON object looks like the below snippet.

JavaScript

But Xano needs it to be one level deeper inside “data”, otherwise I can’t map things up with dot notation…

JavaScript

My JS is below. So where and how can I make the JSON response sit inside “data:”{} ? (I am a complete JS Noob and my code is a Frankenstein monster from various sources as I learn!)

JavaScript

Advertisement

Answer

You can do something like :

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement