Repository navigation
Data Files
.json files (and .dialect files) are Div JSON: everything Div's jsonDecode() accepts. That is JSON plus:
- references as values:
"author": $site.owner; - single quotes, unquoted keys, trailing commas;
- comments.

The editor highlights keys, strings, numbers, constants and references, and validates as you type: an error is painted in place and the status line says JSON [!] line 6, col 47: unexpected 'r', expected a value. When everything is fine it says JSON ok, and how many references the file uses.

Ctrl+T turns the same buffer into a tree. From a template, Ctrl+T opens the tree of its data file (creating page.json if it does not exist yet). Ctrl+T again goes back to the code.

| Key | |
|---|---|
| Enter | edit the item: key, type, value |
| Ins | add an item: inside an object or array, or after a plain value |
| Del | delete the item |
| Ctrl+↑ / Ctrl+↓ | move the item up / down |
| Ctrl+Z / Ctrl+Y | undo / redo (through the code editor's history) |
| F2 | save |
The edit dialog lets you change the type as well as the value: String, Number, True, False, Null, Reference, Object, Array.

The tree and the code are one buffer: typing in the code rebuilds the tree (while the JSON is broken, the last good tree stays and editing is refused until it is fixed), and every tree edit is one edit of the code (Ctrl+Z takes it back). Enter changes only that item in the code: its value, and its key if you renamed it; the rest stays as you wrote it, comments and layout included. Adding, deleting and moving rewrite the code as standard JSON, keeping references bare; if the file uses comments, single quotes or unquoted keys, which a rewrite would drop, divide asks first.
divide · part of Divengine · report an issue
Manual
- The Desktop
- Editing Templates
- Editing PHP
- Outline
- Finding Files and Commands
- Language Servers
- Completion
- Checking Templates
- Rendering
- Render Trace
- Running PHP
- Running Flows
- Flow Structure
- Flow Designer
- Flow Functions
- Flow Simulation
- Function Mock Simulation
- Debugging PHP
- Web Server
- Data Files
- Other Files
- Project Window
- Div Setup
- Dialector
- Translating Templates
- Composer
- Git
Reference
Links