1
有人可以解釋爲什麼會發生這種情況嗎?JSON stringify不完整
var test = JSON
var date = '10-7'
test['id'] = []
test['id'][date] = [[1,2,3]]
test['id'][date].push([1,1,1])
console.log(test) // Output: { id: [ '10-7': [ [Object], [Object] ] ] }
console.log(JSON.stringify(test)) // Output: {"id":[]}
console.log(test['id'][date][0][0]) // Output: 1
在stringily會發生什麼事是,當我救了我的JSON到一個文件中(我用的是jsonfile模塊)什麼也發生。爲什麼它不打印出我想要的JSON?
謝謝,就是這麼做的。你能解釋我試圖在那裏做什麼嗎?那爲什麼發生呢? – SecondLemon
當然。幹得好 :) – Touffy