SQLON (SQL Object Notation) is a strict, SQL-shaped interchange format designed to represent structured data in a relational form. It acts as a canonical internal representation that can be compiled into real SQL and converted to and from formats such as JSON, CSV, and XML.
- Relational-first design - Mirrors relational database concepts directly
- Strict schema enforcement - Explicit types and structure, fails early on malformed input
- Format conversion - Convert between JSON, SQL, and SQLON formats
- Roundtrip testing - Verify data integrity through format conversions
- Human-readable - Designed to be readable and version-control friendly
git clone https://github.com/XanderCalvert/sqlon.git
cd sqlon
go build ./cmd/sqlonThis will create a sqlon executable (or sqlon.exe on Windows).
Convert a SQLON file to SQLite SQL:
sqlon to-sql example.sqlonThis outputs SQLite CREATE TABLE and INSERT statements to stdout.
Run a complete roundtrip conversion pipeline (JSON → SQLON → SQL → SQLON → JSON):
sqlon roundtrip input.jsonThis generates files in the out/ directory:
01.sqlon- Initial SQLON conversion from JSON02.sqlite.sql- SQLite SQL output03.roundtrip.sqlon- SQLON after SQL roundtrip04.json.out.json- Final JSON outputpipeline.log.jsonl- Pipeline execution log
A SQLON file contains one or more tables, defined sequentially. Each table consists of:
- A table declaration (
@table <name>) - Column definitions (
@cols <col1:type1,col2:type2,...>) - Optional primary key (
@pk <column>) - Zero or more data rows (arrays of values)
@table people
@cols id:int, name:text, active:bool
@pk id
[1,"Matt",true]
[2,"Calvert",false]
int- Integertext- Text/Stringbool- Booleandecimal- Decimal numberdatetime- DateTimenull- Null type
SQLON supports both # and -- style comments:
# This is a comment
@table users
@cols id:int, name:text -- Column definitions
@pk id
See the examples/ directory for example files:
input.json- Sample JSON inputinput.sqlon- SQLON representationinput.sqlite.sql- SQLite SQL outputinput.roundtrip.sqlon- SQLON after roundtripinput.out.json- Final JSON output
sqlon/
├── cmd/sqlon/ # CLI application
├── internal/
│ ├── format/ # Format converters (json, sql, sqlon)
│ ├── model/ # Core data model (Database, Table, Column, Row)
│ ├── pipeline/ # Conversion pipeline
│ └── normalise/ # Normalization utilities
├── examples/ # Example files
└── .github/workflows/ # CI/CD workflows
- Relational-first - SQLON mirrors relational database concepts directly
- Strict, not permissive - Ambiguous or malformed input must fail early
- Deterministic - Identical input always produces identical output
- Readable and diff-friendly - Designed for human readability and version control
- Canonical representation - SQLON is the internal normalized form
See SPEC.md for the complete specification and MANIFESTO.md for the project philosophy.
See ROADMAP.md for detailed implementation status and planned features.
This is an experimental project. Breaking changes are expected. The current MVP supports:
- ✅ SQLON parsing and formatting
- ✅ JSON import/export
- ✅ SQLite SQL export/import
- ✅ Roundtrip pipeline testing
- ✅ GitHub Actions CI/CD
When converting JSON to SQLON and back to JSON, the key order of root-level primitive fields may not be perfectly preserved. While the system attempts to preserve the original JSON key order by parsing tokens, some fields (particularly those that appear after arrays or nested objects in the original JSON) may end up in a different position in the roundtrip output.
Example:
- Original:
{"$schema": "...", "version": 2, "customTemplates": [], "settings": {...}} - Roundtrip:
{"$schema": "...", "customTemplates": [], "settings": {...}, "version": 2}
The first root-level primitive ($schema) is correctly positioned, but subsequent primitives may appear after other top-level keys. This is a known limitation and does not affect data integrity—all fields are preserved correctly, only their order may differ.
Workaround: If key order is critical, consider restructuring your JSON to place all primitive fields before arrays and nested objects.
- sqlon-vscode - VS Code syntax highlighting extension for SQLON
MIT License - see LICENSE file for details.
Contributions are welcome! This is an exploratory project, so feel free to experiment and propose changes.