How to convert JavaScript Array to JSON
In JavaScript, you can use JSON.stringify to convert an array or values into a JSON formatted string. var output = {} output[0] = "a"; output[1] = "b"; output[2] = "c"; console.log( JSON.stringify(output) ); Output { "0":"a", "1":"b", "2":"c" } 1. jQuery Ajax Request Often times, you need to convert the JavaScript values into JSON before …