EDN Format
Use EDN (Extensible Data Notation) format for moclojer configuration. Native Clojure syntax with advanced features, code evaluation, and seamless integration with Clojure projects.
EDN (Extensible Data Notation) is moclojer's native configuration format. As a Clojure-based tool, moclojer has first-class support for EDN, offering the most powerful and flexible configuration option.
π What You'll Learn
β EDN syntax basics and advantages
β How to write moclojer configs in EDN
β Advanced features (code evaluation, data structures)
β When to use EDN vs YAML/OpenAPI
β Integration with Clojure projects
π― Why Use EDN?
Advantages
β Native format - Direct Clojure data structures β Code evaluation - Execute Clojure expressions β Rich data types - Keywords, symbols, sets, etc. β Comments - Full line and inline comments β No ambiguity - Precise type system β Clojure integration - Use in your Clojure codebase
When to Choose EDN
β You're using Clojure/ClojureScript
β Need advanced templating features
β Want to evaluate code in responses
β Prefer precision over readability
β Building programmatic configurations
π Quick Start
Basic EDN Configuration
Create moclojer.edn:
Run:
Test:
π EDN Syntax
Data Types
Complete Example
π Advanced Features
1. Comments
2. Multi-line Strings
3. Code Evaluation
4. Shared Data
5. Template Variables (Same as YAML)
π EDN vs YAML Comparison
Readability
βββ
βββββ
Precision
βββββ
βββ
Code evaluation
β Yes
β No
Comments
β Yes
β Yes
Native to moclojer
β Yes
β No
Clojure integration
βββββ
β
Learning curve
βββ (Medium)
ββ (Easy)
Best for
Clojure devs, advanced features
Beginners, simplicity
β
Best Practices
Do β
Don't β
π§ Usage in Clojure Projects
As a Library
Loading from File
π Troubleshooting
Syntax Errors
Problem: Invalid EDN
Solution: Check for:
Unclosed brackets/braces
[ { } ]Missing commas in maps (EDN uses whitespace)
Invalid characters in keywords
Valid:
Template Variables Not Working
Problem: {{path-params.id}} shows literally
Solution: Template variables work in EDN strings:
π See Also
YAML Format Guide - Simpler alternative format
OpenAPI Format - Industry standard specs
Postman Format - Postman Collection support
Template Variables - Dynamic responses
Using as Library - Clojure integration
π Next Steps
Path Parameters - Dynamic URL parameters
Query Parameters - Filters and pagination
Template System - Advanced templating
π‘ Tip: EDN is perfect for Clojure developers who want the full power of Clojure's data structures and code evaluation in their mock configurations!
Last updated
Was this helpful?