README file from
GithubJSON Collapsible Plugin for Obsidian
Display JSON data as beautiful, interactive collapsible trees in your Obsidian notes.
Features
- 🌳 Collapsible JSON Trees: View JSON data with expandable/collapsible nodes
- 🎨 Syntax Highlighting: Color-coded values (strings, numbers, booleans, null)
- 📱 Mobile & Desktop: Works on all Obsidian platforms
- ⚡ Lightweight: Fast rendering with minimal overhead
- 🎯 Simple Usage: Just use standard JSON code blocks
Installation
Manual Installation
-
Download the plugin files
- Download the latest release files from the releases page
- Or download these files directly from the repository:
main.js(required)manifest.json(required)style.css(optional - can be empty, styles are embedded in main.js)
-
Locate your Obsidian vault
- Open Obsidian
- Go to Settings → About → Vault
- Note the vault folder location on your system
-
Create the plugin folder
- Navigate to your vault folder
- Go to
.obsidian/plugins/(create thepluginsfolder if it doesn't exist) - Create a new folder called
json-collapsible
-
Copy the plugin files
- Copy the downloaded files into the
json-collapsiblefolder - At minimum, you need
main.jsandmanifest.json - Your folder structure should look like:
YourVault/ └── .obsidian/ └── plugins/ └── json-collapsible/ ├── main.js ├── manifest.json └── style.css (optional)
- Copy the downloaded files into the
-
Enable the plugin
- Restart Obsidian or reload the vault
- Go to Settings → Community plugins
- You should see "JSON Collapsible" in the list
- Toggle it on to enable the plugin
Usage
Once installed, you can display JSON data in your notes using JSON code blocks:
Basic Example
```json
{
"name": "John Doe",
"age": 30,
"email": "[email protected]"
}
```
Complex Example
```json
{
"users": [
{
"id": 1,
"name": "Alice",
"active": true,
"roles": ["admin", "user"]
},
{
"id": 2,
"name": "Bob",
"active": false,
"roles": ["user"]
}
],
"metadata": {
"total": 2,
"page": 1,
"lastUpdated": "2024-01-01"
}
}
```
Features in Action
- Click the ▼ icon to collapse a node
- Click the ▶ icon to expand a collapsed node
- Item count is shown when a node is collapsed
- Color coding:
- 🟢 Green for strings
- 🟡 Yellow for numbers
- 🔵 Blue for booleans
- Gray for null values
Troubleshooting
Plugin doesn't appear in the list
- Make sure the required files (
main.jsandmanifest.json) are in the correct folder - Check that the folder is named exactly
json-collapsible - Try restarting Obsidian completely
JSON not rendering properly
- Verify your JSON is valid (you can use a JSON validator like JSONLint)
- Make sure you're using triple backticks with
jsonlanguage identifier - Check that the plugin is enabled in Settings → Community plugins
Invalid JSON error
If you see an "Invalid JSON" message, your JSON syntax has an error. Common issues:
- Missing commas between properties
- Trailing commas (not allowed in JSON)
- Unquoted keys
- Single quotes instead of double quotes
Requirements
- Obsidian v0.15.0 or higher
Support
If you encounter any issues or have suggestions:
- Open an issue on GitHub
- Provide details about your Obsidian version and the issue you're experiencing
License
This project is open source and available under the MIT License.
Development
To build or modify the plugin:
- Clone the repository
- Navigate to the repository root
- Make your changes to the files:
main.js- Main plugin code and embedded stylesmanifest.json- Plugin metadatastyle.css- Optional (currently unused, styles are in main.js)
- Copy the modified files from
json-collapsible/to your vault's.obsidian/plugins/json-collapsible/folder for testing - Restart Obsidian or reload the vault to see your changes
Note: This plugin embeds styles directly in main.js using the addStyles() method, so style.css is not currently used.
Enjoy visualizing your JSON data in Obsidian! 🎉