By YiyaoPublished
Make YAML easier to review
Format a YAML document into consistent indentation before reviewing or handing it to another person. Keep the input beside the formatted output so that changes remain visible. Choose Format YAML, inspect the result, then copy or download it.
This tool is for readability and structural checks. The application that consumes the YAML still decides which keys, values and combinations it accepts.
Check values that can change meaning
| Input detail | What to preserve | What to inspect |
|---|---|---|
| A quoted identifier such as "0012" | The string value and leading zeros | It must not become the number 12 |
| A list of records | Record order and each item boundary | Indentation must keep fields inside the correct item |
| A comment explaining a setting | The comment and its useful location | Review the diff before replacing the original |
| A multiline string | Its actual text and line-break behavior | A change between literal and folded styles can change the value |
| An anchor or alias | The reference relationship | Reject excessive expansion rather than freezing the browser |
Choose an indentation width that matches the surrounding project. A cosmetic preference is less important than preserving identifiers, types and the document's meaning.
Use a representative example
Consider a record containing id: "0012", enabled: true and a two-item list of fields: title and url. After formatting, the identifier should still be a string, the enabled setting should still be a boolean, and the field list should contain exactly two items in the same order.
Do not approve a change solely because it looks neater. Compare the parsed values before and after formatting. Then run the destination application's own configuration check.
For a scraped-data workflow, the same principle applies to field definitions. A field accidentally moved beneath another list item may be valid YAML while describing the wrong extraction rule.
Fix errors before copying output
When parsing fails, inspect the indicated location and its surrounding indentation. Tabs used for indentation, inconsistent list nesting and duplicate mapping keys deserve particular attention.
The formatter should not guess which duplicated key you intended to keep. Resolve the duplicate in the input, rerun the operation and review the resulting structure. Keep the last successful output clearly separate from a failed attempt so that an old result is not mistaken for a new one.
Choose the right next step
Keep YAML when humans need to maintain a configuration with comments. Use YAML to JSON when the receiving system needs JSON data and you accept that comments are not part of JSON.
If you are defining a capture-and-processing workflow, separate the acquisition step from formatting. Crawler Console concerns collecting supported web content; this formatter concerns a document you already have. Check the actual input format required by each stage before connecting them.
FAQ and next step
Will formatting make the configuration valid for my application? It can expose syntax errors, but application rules need the application's own validator.
Should I remove quotes to make the file shorter? Keep quotes when they protect an identifier or intended string type. Readability should not change the value.
Does the formatter run configuration instructions? No. Treat the document as data. Review it, then use it only in the intended controlled environment.
