Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions browser/json-viewer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

## 1.0.0

First release of JSON Viewer Veyra for Chrome.

- JSON pages as a tree, with lazy drawing (200 items at a time) for big files.
- Exact big and exactly-written numbers.
- The path of every value, with copy path and copy value.
- Search with match stepping.
- Broken JSON: line, column, the line highlighted and the mistake explained.
- Raw (coloured, 2/4 spaces, tabs or one line) and Original views; copy and download.
- A page to paste JSON or open a file, from the toolbar button.
- Dark, light and automatic themes; the view, indent and theme are remembered.
21 changes: 21 additions & 0 deletions browser/json-viewer/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Vikram Singh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 12 additions & 0 deletions browser/json-viewer/PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# JSON Viewer Veyra: privacy policy

Last updated: 25 November 2026

JSON Viewer Veyra does not collect, store, send or sell any personal data or browsing data.

- **What it reads:** when a page you open is JSON, the extension reads that page's text in your browser to show it as a tree. It reads nothing on other pages.
- **What it stores:** your choice of view, indentation and theme, saved with Chrome's own extension storage (`chrome.storage.sync`), which Chrome may sync to your Google account if you have sync turned on.
- **What it sends:** nothing. The extension makes no network requests and has no analytics, advertising or tracking.
- **JSON you paste or open** on the extension's own page stays in that tab and is gone when you close it.

Questions: [email protected] · FlightCoders, https://flightcoders.com
37 changes: 37 additions & 0 deletions browser/json-viewer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# JSON Viewer Veyra (Chrome extension)

Open any JSON in Chrome and read it as a clear, searchable tree.

![The JSON Viewer tree with a value selected and its path shown](store/1-tree.png)

## What it does

- **A tree you can read.** Open and close any level, with a count of keys and items. Small files open fully, big ones open the top level and show 200 items at a time, so a 10 MB response stays fast.
- **Exact numbers.** Long IDs like `9007199254740993123` and prices like `19.90` are shown exactly as the server sent them. Most viewers round them silently.
- **The path of every value.** Click a value to see `$.items[0].price`, and copy the path or the value.
- **Search.** Keys and values, with Enter and Shift+Enter to step through matches. Ctrl+F jumps to the search box.
- **Mistakes, explained.** Broken JSON shows the line and column, highlights the line, and says plainly what's wrong, like an extra comma before `}`.
- **Raw and Original views.** Formatted and coloured with 2 spaces, 4 spaces, tabs or one line, or the text exactly as the page sent it.
- **Copy and download.** The whole JSON or the selected value.
- **Paste or open a file.** Click the toolbar button to paste JSON or open a `.json` file.
- **Dark, light or automatic** theme. Your view, indent and theme are remembered.

## Private and safe

- Nothing is sent anywhere. No analytics, no account, no network requests.
- The page's data is only ever shown as text: a JSON document can't run code through the viewer, and only `http` and `https` links are made clickable.
- It only changes pages that are JSON (a JSON content type, or plain text that is JSON). Web pages are never touched.
- The only permission is `storage`, to remember your view, indent and theme.

## Develop

```console
npm test # the core: parsing, exact numbers, paths, search, error positions
npm run test:browser # loads the extension into Chromium with Playwright and checks real pages
npm run zip # release/json-viewer-veyra-<version>.zip for the Chrome Web Store
node scripts/screenshots.mjs # store/ screenshots and the promo tile
```

To try it: open `chrome://extensions`, turn on **Developer mode**, click **Load unpacked** and pick this folder.

Made by [FlightCoders](https://flightcoders.com), the team behind the [Veyra](https://veyraeditor.com) editor. MIT licensed.
48 changes: 48 additions & 0 deletions browser/json-viewer/STORE-LISTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Chrome Web Store listing: what to paste where

Upload `release/json-viewer-veyra-1.0.0.zip` at https://chrome.google.com/webstore/devconsole (one-time developer fee: US$5).

## Store listing tab

**Description**

> Open any JSON in Chrome and read it as a clear, searchable tree.
>
> • A tree you can read: open and close any level, with counts of keys and items. Big files stay fast.
> • Exact numbers: long IDs and values like 19.90 are shown exactly as sent, never rounded.
> • The path of every value: click a value to see $.items[0].price, and copy the path or the value.
> • Search keys and values, and step through the matches.
> • Broken JSON? See the line and column, with the line highlighted and the mistake explained, like an extra comma.
> • Raw view with colours and 2-space, 4-space, tab or one-line formatting, and the original text.
> • Copy or download the JSON or the selected value.
> • Paste JSON or open a file from the toolbar button.
> • Dark, light or automatic theme.
>
> Private: nothing is sent anywhere, and there is no tracking. It only changes pages that are JSON.

**Category:** Developer Tools **Language:** English

**Graphics** (in `store/`): icon `icons/icon-128.png`; screenshots `1-tree.png`, `2-search.png`, `3-raw.png`, `4-error.png`, `5-light.png` (1280×800); small promo tile `promo-440x280.png`.

**Homepage URL:** https://veyraeditor.com/json-viewer
**Support URL:** https://github.com/fcopensource/veyraeditor/issues

## Privacy practices tab

**Single purpose**

> Show JSON documents as a readable, searchable tree.

**Permission justification**

- `storage`: Remembers the user's chosen view (tree or raw), indentation and theme.
- Host permission (content script on all URLs): JSON can be opened from any website or API, so the content script checks each page's content type and only changes pages that are JSON. It never reads or changes other pages.

**Remote code:** No, I am not using remote code.

**Data usage:** tick nothing (it collects no user data), then tick the three certifications:
- I do not sell or transfer user data to third parties, outside of the approved use cases
- I do not use or transfer user data for purposes that are unrelated to my item's single purpose
- I do not use or transfer user data to determine creditworthiness or for lending purposes

**Privacy policy URL:** https://veyraeditor.com/json-viewer/privacy
Binary file added browser/json-viewer/icons/icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added browser/json-viewer/icons/icon-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added browser/json-viewer/icons/icon-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added browser/json-viewer/icons/icon-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions browser/json-viewer/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"manifest_version": 3,
"name": "JSON Viewer Veyra",
"short_name": "JSON Viewer",
"version": "1.0.0",
"description": "View JSON as a clear, searchable tree. Exact big numbers, the path of every value, errors with line numbers. Private and offline.",
"minimum_chrome_version": "114",
"icons": { "16": "icons/icon-16.png", "32": "icons/icon-32.png", "48": "icons/icon-48.png", "128": "icons/icon-128.png" },
"action": {
"default_title": "JSON Viewer: paste or open JSON",
"default_icon": { "16": "icons/icon-16.png", "32": "icons/icon-32.png" }
},
"background": { "service_worker": "src/background.js" },
"permissions": ["storage"],
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["src/core.js", "src/render.js", "src/content.js"],
"css": ["src/viewer.css"],
"run_at": "document_end"
}
],
"homepage_url": "https://veyraeditor.com/json-viewer"
}
13 changes: 13 additions & 0 deletions browser/json-viewer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "json-viewer-veyra",
"version": "1.0.0",
"private": true,
"description": "JSON Viewer Veyra, a Chrome extension: JSON pages as a readable, searchable tree.",
"license": "MIT",
"type": "commonjs",
"scripts": {
"test": "node --test test/core.test.mjs",
"test:browser": "node test/browser.test.mjs",
"zip": "node scripts/zip.mjs"
}
}
Binary file not shown.
96 changes: 96 additions & 0 deletions browser/json-viewer/scripts/screenshots.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// Makes the Chrome Web Store screenshots (1280x800) and promo tile (440x280) from the real extension.
// Run: node scripts/screenshots.mjs (PLAYWRIGHT_PATH can point at a playwright package)
import http from "node:http";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";

const ext = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const out = path.join(ext, "store");
fs.mkdirSync(out, { recursive: true });
const require = createRequire(import.meta.url);
const { chromium } = require(process.env.PLAYWRIGHT_PATH || path.resolve(ext, "../../node_modules/playwright"));

const api = `{
"id": 9007199254740993123,
"status": "shipped",
"total": 149.90,
"currency": "EUR",
"customer": { "name": "Northwind Traders", "email": "[email protected]", "website": "https://northwind.example" },
"items": [
{ "sku": "KB-210", "title": "Mechanical keyboard", "qty": 1, "price": 89.90, "tags": ["hardware", "desk"] },
{ "sku": "MS-044", "title": "Wireless mouse", "qty": 2, "price": 30.00, "tags": ["hardware"] }
],
"shipping": { "carrier": "DHL", "tracking": "JD014600006281230452", "eta": "2026-12-02", "address": { "city": "Berlin", "country": "DE" } },
"gift": false,
"coupon": null
}`;
const broken = `{
"name": "veyra-app",
"version": "1.4.0",
"scripts": {
"dev": "vite",
"build": "vite build",
},
"dependencies": { "react": "^19.2.0" }
}`;
const pages = { "/orders/1042.json": api, "/package.json": broken };
const server = http.createServer((req, res) => {
const body = pages[req.url];
if (!body) { res.writeHead(404); res.end(); return; }
res.writeHead(200, { "Content-Type": "application/json" }); res.end(body);
});
await new Promise(r => server.listen(0, "127.0.0.1", r));
const base = `http://127.0.0.1:${server.address().port}`;

const profile = fs.mkdtempSync(path.join(os.tmpdir(), "vjv-shots-"));
const context = await chromium.launchPersistentContext(profile, {
channel: "chromium", headless: true, colorScheme: "dark",
args: [`--disable-extensions-except=${ext}`, `--load-extension=${ext}`],
viewport: { width: 1280, height: 800 },
});
try {
const page = await context.newPage();
// 1. the tree, with a value selected and its path shown
await page.goto(base + "/orders/1042.json");
await page.waitForSelector(".vjv-row");
await page.locator(".vjv-row", { hasText: '"tracking"' }).click();
await page.mouse.move(0, 0);
await page.screenshot({ path: path.join(out, "1-tree.png") });
// 2. search
await page.fill(".vjv-search", "hardware");
await page.waitForFunction(() => document.querySelector(".vjv-hits")?.textContent.includes("of"));
await page.screenshot({ path: path.join(out, "2-search.png") });
// 3. raw, coloured
await page.fill(".vjv-search", "");
await page.click(".vjv-tab >> text=Raw");
await page.screenshot({ path: path.join(out, "3-raw.png") });
await page.click(".vjv-tab >> text=Tree");
// 4. a mistake, found
await page.goto(base + "/package.json");
await page.waitForSelector(".vjv-error");
await page.screenshot({ path: path.join(out, "4-error.png") });
// 5. light theme
await page.goto(base + "/orders/1042.json");
await page.waitForSelector(".vjv-row");
await page.click("text=◐ Auto"); await page.click("text=● Dark");
await page.locator(".vjv-row", { hasText: '"total"' }).click();
await page.mouse.move(0, 0);
await page.screenshot({ path: path.join(out, "5-light.png") });

// the small promo tile, drawn as HTML
const tile = await context.newPage();
await tile.setViewportSize({ width: 440, height: 280 });
const icon = fs.readFileSync(path.join(ext, "icons", "icon-128.png")).toString("base64");
await tile.setContent(`<body style="margin:0;width:440px;height:280px;display:flex;align-items:center;gap:22px;padding:0 34px;box-sizing:border-box;background:radial-gradient(400px 260px at 0% 0%,#1e3a4a,transparent 70%),#0d1117;font-family:Segoe UI,system-ui,sans-serif;color:#e9f3ff">
<img src="data:image/png;base64,${icon}" width="104" height="104">
<div><div style="font-size:30px;font-weight:800;letter-spacing:-.6px;line-height:1.05">JSON Viewer</div>
<div style="margin-top:10px;font-size:15px;color:#9fb3c6;line-height:1.45">A clear, searchable tree.<br>Exact numbers. Private.</div></div></body>`);
await tile.screenshot({ path: path.join(out, "promo-440x280.png") });
console.log("Saved to", out, fs.readdirSync(out).join(", "));
} finally {
await context.close(); server.close();
try { fs.rmSync(profile, { recursive: true, force: true, maxRetries: 5, retryDelay: 300 }); } catch { /* temp */ }
}
45 changes: 45 additions & 0 deletions browser/json-viewer/scripts/zip.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Builds release/json-viewer-veyra-<version>.zip for the Chrome Web Store: the manifest, src/ and icons/ only.
// No dependencies: a small zip writer with Node's zlib.
import fs from "node:fs";
import path from "node:path";
import zlib from "node:zlib";
import { fileURLToPath } from "node:url";

const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const manifest = JSON.parse(fs.readFileSync(path.join(root, "manifest.json"), "utf8"));
const files = ["manifest.json", ...["src", "icons"].flatMap(dir => fs.readdirSync(path.join(root, dir)).sort().map(f => `${dir}/${f}`))];

const table = new Uint32Array(256).map((_, n) => { let c = n; for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1; return c >>> 0; });
const crc32 = buf => { let c = 0xffffffff; for (const b of buf) c = table[(c ^ b) & 0xff] ^ (c >>> 8); return (c ^ 0xffffffff) >>> 0; };
// A fixed date (2026-01-01), so the same files always make the same zip.
const DOS_TIME = 0, DOS_DATE = ((2026 - 1980) << 9) | (1 << 5) | 1;

const locals = [], centrals = [];
let offset = 0;
for (const name of files) {
const data = fs.readFileSync(path.join(root, name));
const packed = zlib.deflateRawSync(data, { level: 9 });
const crc = crc32(data), nameBuf = Buffer.from(name);
const local = Buffer.alloc(30);
local.writeUInt32LE(0x04034b50, 0); local.writeUInt16LE(20, 4); local.writeUInt16LE(0, 6); local.writeUInt16LE(8, 8);
local.writeUInt16LE(DOS_TIME, 10); local.writeUInt16LE(DOS_DATE, 12); local.writeUInt32LE(crc, 14);
local.writeUInt32LE(packed.length, 18); local.writeUInt32LE(data.length, 22); local.writeUInt16LE(nameBuf.length, 26);
locals.push(local, nameBuf, packed);
const central = Buffer.alloc(46);
central.writeUInt32LE(0x02014b50, 0); central.writeUInt16LE(20, 4); central.writeUInt16LE(20, 6); central.writeUInt16LE(0, 8); central.writeUInt16LE(8, 10);
central.writeUInt16LE(DOS_TIME, 12); central.writeUInt16LE(DOS_DATE, 14); central.writeUInt32LE(crc, 16);
central.writeUInt32LE(packed.length, 20); central.writeUInt32LE(data.length, 24); central.writeUInt16LE(nameBuf.length, 28);
central.writeUInt32LE(offset, 42);
centrals.push(central, nameBuf);
offset += 30 + nameBuf.length + packed.length;
}
const centralSize = centrals.reduce((n, b) => n + b.length, 0);
const end = Buffer.alloc(22);
end.writeUInt32LE(0x06054b50, 0); end.writeUInt16LE(files.length, 8); end.writeUInt16LE(files.length, 10);
end.writeUInt32LE(centralSize, 12); end.writeUInt32LE(offset, 16);

const out = path.join(root, "release", `json-viewer-veyra-${manifest.version}.zip`);
fs.mkdirSync(path.dirname(out), { recursive: true });
fs.writeFileSync(out, Buffer.concat([...locals, ...centrals, end]));
console.log(`${path.relative(root, out)}: ${files.length} files, ${(fs.statSync(out).size / 1024).toFixed(1)} KB`);
console.log(files.map(f => " " + f).join("\n"));
4 changes: 4 additions & 0 deletions browser/json-viewer/src/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// JSON Viewer Veyra: the toolbar button opens the viewer page, to paste JSON or open a file.
chrome.action.onClicked.addListener(() => {
chrome.tabs.create({ url: chrome.runtime.getURL('src/viewer.html') });
});
38 changes: 38 additions & 0 deletions browser/json-viewer/src/content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* JSON Viewer Veyra: turns a page that is only JSON into the viewer. On every other page it stops at once:
* a web page is text/html, and the browser shows JSON as one <pre> and nothing else.
*/
(function () {
'use strict';
const V = window.VJV;
if (!V || document.documentElement.classList.contains('vjv-page')) return;
const type = (document.contentType || '').toLowerCase();
const jsonType = V.isJsonType(type);
if (!jsonType && type !== 'text/plain') return;
const body = document.body;
if (!body) return;
// Chrome shows a JSON response as <pre>text</pre>, plus its own small "Pretty-print" box in newer versions.
const pre = body.querySelector(':scope > pre');
if (!pre) return;
const builtIn = [...body.children].filter(e => e !== pre);
if (builtIn.some(e => !e.classList.contains('json-formatter-container'))) return;
const text = pre.textContent || '';
if (text.length > 60 * 1024 * 1024) return; // over 60 MB: leave it to the browser
if (!jsonType && !V.looksLikeJson(text)) return;
const parsed = V.parse(text);
if (!parsed.ok && !jsonType) return; // plain text that only looked like JSON

const KEY = 'vjvSettings';
const storage = typeof chrome !== 'undefined' && chrome.storage && chrome.storage.sync;
const start = settings => {
pre.hidden = true; pre.style.display = 'none';
for (const e of builtIn) e.style.display = 'none';
document.documentElement.classList.add('vjv-page');
const host = document.createElement('div');
host.className = 'vjv-host';
body.appendChild(host);
const name = decodeURIComponent((location.pathname.split('/').pop() || location.hostname || 'data').replace(/\.json$/i, ''));
V.mount(host, { text, parsed, settings, title: name, saveSettings: s => storage && storage.set({ [KEY]: s }) });
};
if (storage) storage.get(KEY).then(r => start(r && r[KEY]), () => start()); else start();
})();
Loading
Loading