Converts a JavaScript array to JSON String