0

这有效:(更新:但不是我想的那样!它实际上设置了 b = "c, d: e")

a: [
   { b: c, d: e 
   }
]

这有效:

a: [
   { "b": "c", "d": "e" }
]

但这不起作用。hjson 定义不允许在行尾使用右大括号怎么办?

a: [
   { b: c, d: e }
]

Found ']' where a key name was expected
(check your syntax or use quotes if the key name
 includes {}[],: or whitespace): line 3 column 1 (char 23)
4

1 回答 1

1

在 Hjson 中,不带引号的字符串由换行符终止,因此您的右括号会被无引号字符串吃掉。

当你写

{ b: c, d: e 
}

你是说,给我一个包含"c, d: e".

您需要使用任一引号

{ b: "c", d: "e" }

或者

{ 
  b: c
  d: e
}
于 2016-05-01T14:35:36.993 回答