jojacafe
6/13/2016 - 2:35 PM

JSON and Object

JSON and Object

(function() {
  
  var object = new Object();

  var id = "identity";
  var id1 = "identity1";
  var id2 = "identity2";
  var value = "1,2,3";
  var value1 = "1,2,3,4";
  var value2 = "1,2,3,4,5";
  
  object[id] = value;
  object[id1] = value1;
  object[id2] = value2;
  
  
  $("body").html(JSON.stringify(object));
  
}());
(function() {
  
  var parent = {}
  var object = [];

  var id = "identity";
  var value = "1,2,3";
  
  object.push({
    [id]: value
  });
  
  object.push({
    [id]: value
  });
  
  $("body").html(JSON.stringify(object));
  
}());
(function() {
  
  var object = {};
  var json = [];

  var id = "identity";
  var value = "1,2,3";

  object.priorities = json;
  
  object.priorities.push({
    [id]: value
  });
  
  object.priorities.push({
    [id]: value
  });
  
  $("body").html(JSON.stringify(object));
  
}());