On Jun 10, 2015, at 11:10 PM, Martin Fares wrote: > > Hey guys, I'm creating a page in HTML(duh) but I'm kinda stuck, I need to > create a list and save it/transform it into a Json so I can export it. > > I randomly read node.js was good for this, I was wondering if a good soul > with node knowledge can confirm if this is true or if there exist a easy way > to do it or/and a library that might help me here?
Node is a server-side JavaScript runtime. You can talk to it from your client-side JavaScript code, but it's up to your client-side JavaScript code to send the right data. If all you want to do is convert a JavaScript object or array in memory in your JavaScript engine into JSON, then you just need the JSON.Stringify method. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify This is not node-specific; it's plain basic JavaScript, so you can do it in any JavaScript runtime (including node, but also including the ones running in your browser, if that's where this code is going to run). var list = ['hello', 'world'] var listAsJson = JSON.stringify(list) // listAsJson now contains the string '["hello","world"]' -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/BE131EE0-2F91-4CBF-877D-99C5C32ED2AC%40ryandesign.com. For more options, visit https://groups.google.com/d/optout.
