I am working on a freelance project. I have a Yaml file that I want to convert to JSON. But before I convert it to JSON, I need to remove the first line and anything on that line.
data.yml file (“data:” needs to be removed):
data:
name: XYZ Company
location: Portland, OR
services:
development: yes
design: no
The edited Yaml data file I need to convert to JSON:
name: XYZ Company
location: Portland, OR
services:
development: yes
design: no
The reason I need to do this is because I don’t actually need the first part of the Yaml file (I only use it for Netlify CMS collections config so my client can edit the data file).
Here’s what I have, but Middleman doesn’t work and gives me an undefined method error:
<%= YAML.load_file('data/data.yml').sub('data','').to_json %>
Any thoughts as to how I can achieve this?