Answers for "array to json in jquery"

2

how to convert array to string json

var arr = [ "John", "Peter", "Sally", "Jane" ];
var myJSON = JSON.stringify(arr);
Posted by: Guest on July-25-2020
0

jquery elements to json

var data = $('div.item').map(function(){
    return {
        classname: 'item',
        content: $(this).text()
    };
}).get();
Posted by: Guest on October-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language