I am writing a fixture for my table. And a one of the coloums takes in a JSON string as a value.
The problem is the fixture is not loading failing as:
If you have the string, you can use as simple as Vlad Khomich mentioned:
portslist: '[{"name":"ob1","port_num":0,"port_type":"network"},...]'
If you are using ERB and have an object, you can use to_json and inspect to escape to a JSON string:
portslist: <%= [{name: 'ob1', port_num: 0, port_type: 'network'},...].to_json.inspect %>
And if you have a large JSON specification, you can store it in a separated file and load using Ruby, so you can keep your YAML file clean:
portslist: <%= File.read('/path/to/file.json').inspect %>