The converter parses the JavaScript object literal with JSON5, then serializes the parsed data as YAML. Objects become YAML mappings, arrays become sequences, and the output can keep source order or sort mapping keys alphabetically.
This tool does not run JavaScript. Functions, computed properties, prototypes, and undefined are outside the supported data model, and input comments are parser syntax rather than YAML comments to preserve.
Common questions and answers about this topic.
A JSON5-style JavaScript object literal uses curly braces with quoted or unquoted keys and can include comments plus trailing commas. YAML uses indentation-based structure and supports its own comments, multi-line strings, anchors, and aliases. Executable JavaScript values such as functions and undefined are outside this converter's data model.
Yes, you can sort all YAML mapping keys alphabetically (A to Z) using the sort keys dropdown, or retain the original property order from your JS object. The sorting recurses through all nested mappings in the YAML output.
Yes, the YAML output indentation supports 2 to 8 spaces via the formatting options. When converting JS objects to YAML for configuration files, 2 spaces is the widely adopted standard.
No, the JS object to YAML conversion runs entirely in your browser. Your JavaScript source code is parsed and converted locally and never uploaded to any server.