JSON crash course


Hi, Wel come to Fahad Hussain Free Computer Education Here you can learn Complete computer Science, IT related course absolutely Free! In this only one video I am going to manage almost all concept of JSON For watch related video:https://www.youtube.com/watch?v=FfHpNg3ggSA&list=PLtCBuHKmdxOeFGqKwuP45XBygG1ETZtQ0
For All courses Videos:https://www.youtube.com/channel/UCapJpINJKHzflWwCQ8Kse2g/playlists



Here is the complete JSON code:

<!DOCTYPE html>
<html>
<head>
<title>JSON File</title>
</head>
<body>

<h4 id="aa"></h4>
<h4 id="bb"></h4>
<h4 id="cc"></h4>
<h4 id="dd"></h4>

<script>
/*var text =
{
"name":"Fahad Hussain",
"RollNo":150,
"Height":5.11,
arr:["Fahad","Hussain","Faculty"],
"Salary":null,
"Married":false,
address:{
"HouseNo":45,
"Street":8,
"Colony":"Kahro"
},
}
var arrobj=[
{
"HouseNo":445,
"Street":328,
"Colony":"Kahro",
},
{
"HouseNo":845,
"Street":18,
"Colony":"Kahro",
},
{
"HouseNo":495,
"Street":858,
"Colony":"Kahro",
},
];

//console.log(text.address);
document.getElementById("aa").innerHTML=text.address.Colony;

var result='';
for(i=0;i < arrobj.length;i++)
{
result += '<h1>'+ arrobj[i].Colony +'</h1>'
}

document.getElementById("bb").innerHTML=result;
document.getElementById("cc").innerHTML=JSON.stringify(text);
*/

var text ='{"Name":"Fahad","Age":60,"Height":5.11}'
var obj =JSON.parse(text);
document.getElementById("dd").innerHTML=obj.Name+ ", "+ obj.Height;

</script>

</body>
</html>

2 comments:

  1. Great crash course on JSON Fahad Bhaai. Please come up with something on Tableau.

    ReplyDelete

Fell free to write your query in comment. Your Comments will be fully encouraged.