Skip to content
toolbelt
Back to Guides

Reading a Kubernetes Manifest as Plain Data

By ·

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?
JSON has no comment syntax, so they cannot survive. Keep the YAML as the source of truth.
Are anchors expanded?
Yes. The output is plain data with no references.
Why does a string look quoted in the JSON?
JSON always quotes strings. That is not a conversion artefact.
What usually causes a parse failure?
Tabs, or inconsistent indentation. YAML needs spaces.

Ready to try it out?

Put this knowledge into practice with our free tool.

Go to Tool

Related tools