I am trying to render a yaml object in chef template it is working fine but as we know in yaml spaces also matters so it is creating new properties.
collection: <%= @collection.to_hash.to_yaml %>
Where collection is a json object
collection = { "name": "col1", "nested": { "nKey": 1 } }
Expected result is
collection:
name: col1
nested:
nKey: 1
Getting result
collection: ---
name: col1
nested: !ruby/hash:Mash #nested is not part of collection.
nKey: 1
And second is there any way to remove types(!ruby/hash:Mash
) and ---
from to_yaml function ?