Reading a Kubernetes Manifest as Plain Data
By toolbelt maintainers ·
Updated
You want to check what your pipeline will actually apply. Converting the YAML to JSON makes it inspectable.
What is this tool?
YAML and JSON describe the same data. Converting gives you a form your language can parse and your tests can assert on.
How it works
The YAML is parsed — resolving anchors and aliases — and serialised as indented JSON. Because this is structural, comments disappear and duplicate keys collapse to their last value, which is precisely what your parser would do anyway.
Example
service:
name: api
ports:
- 8080
becomes
{
"service": {
"name": "api",
"ports": [8080]
}
}When to use it
Inspecting a manifest without a cluster. Turning a CI config into a test fixture. Catching a duplicate key that YAML accepted silently.
Optimization Tips
Convert once and read the output carefully when inheriting a config. A duplicate key or an unquoted `yes` is invisible in YAML and obvious in JSON.
Frequently Asked Questions
Where did my comments go?
Are anchors expanded?
Why does a string look quoted in the JSON?
What usually causes a parse failure?
Related tools
- CSV to JSONConvert CSV data to a JSON array of objects. Automatically maps the first row to object keys, perfect for importing spreadsheet data into web applications or APIs.
- JSON to CSVConvert a JSON array into a clean CSV file. Extract unique keys to form the header row, perfect for exporting API data for analysis in Excel or Google Sheets.
- XML to JSONConvert XML documents to JSON objects. Bridge the gap between legacy SOAP APIs and modern frontend applications while preserving attributes and hierarchical data.
- JSON to XMLConvert JSON objects to valid XML markup. Automatically handle arrays, attributes, and special characters, making it easy to integrate with older enterprise systems.