Closed RussellHaley closed 5 years ago
You could use e.g. dkjson?
One alternative would be to use the JSON.stringify
replacer argument to specify how to serialise lua objects.
A simpler alternative may be to not build the response in a lua table, but instead build JS objects directly. e.g. with js.new(js.global.Object)
Thanks, js.new(js.global.Object)
is what I needed.
Sorry, I can't seem to find an answer to this anywhere:
I want to build a response in a lua table, then convert it to a JSON object and then stringify it to send out a websocket. How do I do that? I assume the last step is JSON:stringify(myjson).