一个是如何创建JSON:
var obj = {}; obj[‘name‘] = value; obj[‘anotherName‘] = anotherValue;
如果要创建多级的JSON,则:
ips[ipId] = {}; ips[ipId][‘name‘] = value; ips[ipId][‘anotherName‘] = anotherValue;
注意要用bracket[]而不能用点. 来访问json object
bracket虽然写起来麻烦一些,但是可以避免很多错误!
http://*.com/questions/4071499/dynamically-add-variable-name-value-pairs-to-json-object
http://www.dev-archive.net/articles/js-dot-notation/
http://*.com/questions/7102704/how-to-use-variables-in-dot-notation-like-square-bracket-notation