YAML Format
Learn YAML syntax for configuring your mocks in moclojer. Complete guide with practical examples and best practices.
Why YAML?
Basic Structure
- endpoint:
method: GET
path: /hello
response:
status: 200
body: "Hello, World!"
- endpoint:
method: POST
path: /users
response:
status: 201
body: '{"id": 1, "name": "Alice"}'Essential YAML Syntax
1. Indentation
2. Strings
3. Numbers and Booleans
4. Lists
5. Objects (Maps)
6. Comments
Complete Annotated Example
Best Practices
β
Do
β Avoid
YAML Troubleshooting
Problem: "YAML parse error: mapping values are not allowed"
Problem: "YAML parse error: did not find expected key"
Problem: Broken JSON in body
YAML Validation
Online
Editors
Command line
Comparison with Other Formats
YAML vs JSON
YAML vs EDN
Next Steps
See Also
Last updated
Was this helpful?