无法创build一个数组作为属性的对象

Node.js-Node.js,没有浏览器,枪0.8.8

我创build一个对象

const body = { a: { must: [ { name: 'first', size: 1 } ] } }; gun.get('watcher/f0de26c0-a29f-11e7-8661-154b982951a4').put(body); 

接收错误

 Invalid value at 'a.must'! 

服务器

 const Hapi = require('hapi'); const Gun = require('gun'); const server = new Hapi.Server; server.connection({ port: 8080 }); server.connections.forEach(c => Gun({ web: c.listener, file: 'data.json' })); server.start(); 

枪不跟踪数组。 你有几个select来表示一个数组,取决于你想要元素本身被跟踪还是数组作为一个整体。

1)使一个对象的行为有点像一个数组

 { 0: 1, 1: 134, 2: "abc" } 

2)将数组进行string化,并将其存储为一个固定字符

 { val : '[1,134,"abc"]' }