Created
July 24, 2016 17:22
-
-
Save uyu423/c2e638fe243e2f69fdb2125cbb9997f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>JSON Basic</title> | |
<meta charset="utf-8"/> | |
</head> | |
<body> | |
<script> | |
/* JSON Definition */ | |
var json = '{ "NAME" : "Yongwoo", "AGE" : 25, "UNIVERSITY" : "Catholic Univ, of Korea", "MAJOR" : "Computer Science" }'; | |
/* JSON Parse and Check */ | |
var jsonObj = JSON.parse(json); | |
document.write("<br/><b>JSON Object</b><br/>"); | |
for(var objVarName in jsonObj) { | |
document.write(objVarName, " : ", jsonObj[objVarName], "<br/>"); | |
} | |
/* JON Object to JSON String */ | |
var jsonStr = JSON.stringify(jsonObj); | |
document.write("<br/><b>JSON String Format :</b> ", jsonStr, "<br/>"); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment