1var person={"first_name":"Tony","last_name":"Hawk","age":31};
2var personJSONString=JSON.stringify(person);
1import org.json.simple.JSONObject;
2
3class JsonEncodeDemo {
4
5 public static void main(String[] args) {
6 JSONObject obj = new JSONObject();
7
8 inputJSON.put("subscriberName", "subscriber");
9 inputJSON.put("msisdn","7055389495");
10
11 System.out.print(obj);
12 }
13}
1var jsonArray = '{"required":1, "minlength":2}'
2var jsonParsedArray = JSON.parse(jsonArray);
3for (key in jsonParsedArray) {
4 if (jsonParsedArray.hasOwnProperty(key)) {
5 console.log("%c "+key + " = " + jsonParsedArray[key],"color:cyan");
6 }
7}
1var myObj, x;
2myObj = {"name":"John", "age":30, "car":null};
3x = myObj.name;
4document.getElementById("demo").innerHTML = x;