JAVASCRIPT convert json to array javascript - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution

convert json to array javascript


 141

Show ResultJAVASCRIPT


2

<!DOCTYPE html>
<html>
<body>

<div id="demo"></div>

<script>

var myObj, i, x = "";
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myObj = JSON.parse(this.responseText);
var result = [];

for (i in myObj.records) {

result.push(myObj.records[i].Tech);

}

document.getElementById("demo").innerHTML = result;

}
};
xmlhttp.open("GET", "/json/json.txt", true);
xmlhttp.send();

</script>

</body>
</html>

// this json put into json.txt
{
"records": [
{
"Tech": "Angularjs",
"Side": "client"
},
{
"Tech": "Javascript",
"Side": "client"
},
{
"Tech": "PHP",
"Side": "server"
},
{
"Tech": "Node.js",
"Side": "server"
}
]
}


By     Created   
The power of the user (%)
68%



The most helpful JAVASCRIPT solutions

How to get client machine name or computer name with javascript ?How to get client machine name or computer name with javascript ?JAVASCRIPT

Click to see more ...

  4.7K     383

get client hostname javascriptget client hostname javascriptJAVASCRIPT

Click to see more ...

  2.5K     254

detect ie javascriptdetect ie javascriptJAVASCRIPT

Click to see more ...

  1.5K     159

Create fireworks using javascriptCreate fireworks using javascriptJAVASCRIPT

Click to see more ...

  1.4K     113

create 3d barrel using javascriptcreate 3d barrel using javascriptJAVASCRIPT

Click to see more ...

  1.3K     83

get ip address javascriptget ip address javascriptJAVASCRIPT

Click to see more ...

  768     74

how to create foreach class using javascript ?how to create foreach class using javascript ?JAVASCRIPT

Click to see more ...

  739     73

create qr code javascriptcreate qr code javascriptJAVASCRIPT

Click to see more ...

  536     71

how to create the connect to a database with ADODB using javascript ?how to create the connect to a database with ADODB using javascript ?JAVASCRIPT

Click to see more ...

  475     59

get filename using javascript get filename using javascript JAVASCRIPT

Click to see more ...

  446     56