JSON Viewer/Tree Formatter

Pro JSON Viewer & Tree Formatter

JSON Viewer & Tree Formatter

[Header Ad Space]
Input JSON
Tree View
[Footer Ad Space]

Features & Implementation Details

  1. Recursive Tree Generation: The createTree function calls itself whenever it encounters a nested object or array. This allows the tool to handle JSON of any depth.

  2. Collapsible Nodes: Clicking the [-] or [+] signs toggles a CSS class that hides or shows nested lists, making it easy to navigate massive data structures.

  3. Syntax Highlighting: Different colors are assigned to keys, strings, numbers, and booleans using specific CSS classes to improve readability.

  4. Error Handling: If the user pastes invalid code, the tool catches the error and displays a helpful message instead of crashing.

  5. AdSense Readiness: * Header Ad: High visibility above the main tool.

    • Footer Ad: Captures revenue as users finish their task.

    • Responsive: Uses a CSS Grid that stacks the input and output vertically on smaller screens.

How to Deploy

  • Save the file as json-viewer.html.

  • Replace ca-pub-YOUR_CLIENT_ID with your actual AdSense Publisher ID.

  • If you want to change the theme, modify the CSS variables in the :root section.