Json
: JavaScript Object Notation
JSON.stringify()
: 인자로 들어와 있는 데이터를 문자열로 변환시켜주는 역할
JSON.parse()
: 인자로 들어온 문자열을 데이터로 변환시켜주는 역할
var aJsonArray = new Array();
var aJson = new Object();
aJson.korName = "삽잡이";
aJson.engName = "shovelMan";
aJson.sex = "남";
aJson.bloodType = "B";
aJsonArray.push(aJson);
aJson.kroName = "삽돌이";
aJson.engName = "sapMan";
aJson.sex = "여";
aJson.bloodType ="A";
aJsonArray.push(aJson);
var sJson = JSON.stringify(aJsonArray);
var aJson = new Object();
aJson.name = "삽잡이";
aJson.profile = {engName : "shovelMan", sex : "남", bloodType : "B"};
var sJson = JSON.stringify(aJson);
var aTotalJson = new Array();
var aSapArray = new Array();
var aJson = new Object();
aJson.korName = "삽잡이";
aJson.engName = "shovelMan";
aSapArray.push(aJson);
var aZapArray = new Array();
aJson = new Object();
aJson.korName = "김모군";
aJson.engName = "Kim";
aZapArray.push(aJson);
aTotalJson.sap = aSapArray;
aTotalJson.zap = aZapArray;
참조
https://blog.shovelman.dev/794 [한글로는 삽잡이, 영어로는 shovelman:티스토리]