Skip to main content

Posts

Showing posts from November, 2017

creating json object with variables

if you need double quoted JSON use   JSON.stringify( object) var $items = $ ( '#firstName, #lastName,#phoneNumber,#address ' ) var obj = {} $items . each ( function () { obj [ this . id ] = $ ( this ). val (); }) var json = JSON . stringify ( obj ); Ref : https://stackoverflow.com/questions/12979335/creating-json-object-with-variables