I have an json
data having property attributes.data
. When I console.log(attributes.data)
this value I get the result {"uid" : 1}
I want to convert this to an array.
i.e {"uid" : 1}
and so on I want to convert this to form data uid:1
. how I will do that in javascripts.
if (attributes.type == "POST") {
xmlhttp.open(attributes.type, attributes.url, true);
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
attributes.data = JSON.stringify(attributes.data);
xmlhttp.send(attributes.data);
}