一尘不染

将JSON数据嵌入到YAML文件中

json

我正在为桌子写夹具。并且其中之一接受JSON字符串作为值。

问题是灯具未加载失败,原因是:

Fixture::FormatError: a YAML error occurred parsing /home/saurajeet/code/dcbox/test/fixtures/hardware.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html
The exact error was:
  ArgumentError: syntax error on line 145, col 73: `  portslist: [{"name":"ob1","port_num":0,"port_type":"network"},{"name":"ob2","port_nu'.....

任何解决方案。


阅读 608

收藏
2020-07-27

共1个答案

一尘不染

我认为将引号括起来应该可以解决问题:

portslist: '[{"name":"ob1","port_type" ... }]'
2020-07-27