{"firstname":"Leo", "address.address1":"13, Boardwalk","address.address2":"Street 27"},
function convert(data){ var result = {}; for(var field in data){ var val = data[field]; if ($.isPlainObject(val)){ for(var subField in val){ result[field+'.'+subField] = val[subField]; } } else { result[field] = val; } } return result;}var data = { "firstname":"Leo", "address":{ "address1":"13, Boardwalk", "address2":"Street 27" }, "city":"Bangalore"};data = convert(data);console.log(data)