Articles ยท Developer Tools
Format YAML without dropping a duplicate key
YAML is how many apps describe environment, CI, and Kubernetes-shaped config. Two NODE_ENV lines are not a style issue; they are a bug if a parser keeps the last value and never tells you. A formatter that pretty-prints mappings and sequences, reports the first syntax error with a line, and lists duplicate keys is faster than scrolling a wall of indent. A tree is how you copy app.database.host without counting spaces. YAML↔JSON belongs in the Universal Data Converter, not a second homemade engine.
Why this is worth doing in the browser
Libraries that accept !!python/object or similar tags can instantiate types. That is not a formatter; that is a gadget. The DevNestro YAML Formatter, Validator & Viewer keeps a safe schema only: mappings, sequences, quoted and plain scalars, comments, nested indent. Tags are rejected. Tabs used as indentation fail with a line number. Duplicate keys such as NODE_ENV twice produce Duplicate key and the line of the second definition; both lines stay in the document instead of being silently dropped. Paste or upload .yaml, .yml, or .txt up to the configured 10 MB limit; oversized files are rejected, not truncated. Format or validate. Search keys, values, or paths. YAML to JSON and JSON to YAML reuse the Universal Data Converter. Large YAML reduces highlighting so the tab stays usable.
How to use the tool
Paste the file you actually deploy. Validate if you only need to know whether it parses. Format when you want consistent indent. Read duplicate-key warnings before you convert to JSON, because JSON cannot keep two keys of the same name. Download uses a sanitized local filename.
- Paste the full document, including comments you still want after format.
- Fix duplicate keys when the second line was an accident, not when you needed both for a merge tool.
- Treat a tags-not-supported error as a stop, not as a request to enable constructors.
- Convert through the Universal Data Converter when you need JSON, not by pasting into an unsafe loader.
- Clear the editor if the config should not stay on screen.
Privacy
Formatting, validation, search, and downloads run in the current browser. YAML is not uploaded to DevNestro, not stored as a catalogue of configs, and not sent to analytics. There is no account.
Stop losing the second NODE_ENV. Open the YAML Formatter, validate, pretty-print, and keep constructors off.