#How to send back json

1 messages · Page 1 of 1 (latest)

stray fiber
#

I would like to send back json in the start of the file.
Is something like this possible? Example:

---
return {key: "value"}
---

Or do I need to stringify the object and put it in body? Like this:

---
const myObj = {key: "value"}
let responseText: String = JSON.stringify(myObj)
---
{responseText}
olive walrus
#

I'd understood correctly, you want to display json in your page ?

stray fiber
#

I have an api endpoint and I want to return json

#

I query my database for object

olive walrus
#

"return json" from a page?

stray fiber
#

I mean I want to sendback json

olive walrus
stray fiber
#

k