I was exploring developing in Node.JS and found ExpressJS and RailwayJS (based on Express) which are frameworks for Node. The templating engine used Jade/EJS appears to be more for HTML. How might I generate JSON, eg. when I develop an API
I was exploring developing in Node.JS and found ExpressJS and RailwayJS (based on Express)
Share
You just create normal JavaScript objects, for example:
and
turns it into JSON string. Note that
xmay contain functions which will be omitted. AlsoJSON.stringifyreturnsx.toJSON()if.toJSON()is available.