When it comes to serialising to JSON, I don't think there's a better option than JSON.stringify() in Node, which is what response.json() uses in express, by the way.
If you need to map database objects to response objects, you don't really need to pull in a library, you can just write a function to do any data transformation you need.
constmapPonyToResponse=(pony)=>({name:pony.name,gender:pony.gender||'female',type:types[pony.type].human_readable,// And so on.})
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
When it comes to serialising to JSON, I don't think there's a better option than
JSON.stringify()
in Node, which is whatresponse.json()
uses in express, by the way.If you need to map database objects to response objects, you don't really need to pull in a library, you can just write a function to do any data transformation you need.