Skip to content

About

JSON Toolkit - A powerful JSON toolbox built with Rust + Tauri. Format, minify, sort, decode, JSONPath, tree view, table view, diff, schema validation, CSV conversion.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

17 Commits

Folders and files

Repository files navigation

โšก JSON Toolkit

A powerful multi-platform JSON toolbox built with Rust + Tauri 2.0 + React. One Rust core, every platform โ€” desktop, web, mobile, browser extension, and mini program.

Live Demo: https://junhey.github.io/json-toolkit/

Features

10 core JSON tools, all powered by a shared Rust core:

Tool Description Web Desktop Extension Mini Program
Formatter Beautify JSON with configurable indent โœ… โœ… โœ… โœ…
Minifier Compress JSON, remove all whitespace โœ… โœ… โœ… โœ…
Sorter Sort by key or value, ascending/descending โœ… โœ… โœ… โœ…
Codec Toolkit 24 encode/decode transforms (Unicode/URL/UTF16/Base64/MD5/Hex/SHA1/HTML/Gzip/JWT/Cookie/Proto Hexโ€ฆ) โœ… โœ… โœ… โœ…
JSONPath Query JSON with JSONPath expressions โœ… โœ… โœ… โœ…
Tree View Collapsible interactive JSON tree browser โœ… โœ… โœ… โ€”
Table View Flatten JSON arrays/objects to tables โœ… โœ… โœ… โ€”
Diff Compare two JSON objects, highlight changes โœ… โœ… โœ… โ€”
Schema Validator Validate JSON against JSON Schema โœ… โœ… โ€” โ€”
CSV Converter Convert between JSON and CSV/TSV โœ… โœ… โœ… โœ…

Platform Support

Platform Status Tech How to Get
Web โœ… Deployed Vite + React + WASM Open in browser
macOS โœ… Ready Tauri 2.0 pnpm build:tauri โ†’ .dmg / .app
Windows โœ… Ready Tauri 2.0 CI builds .msi / .exe on tag push
Linux โœ… Ready Tauri 2.0 CI builds .deb / .AppImage on tag push
Android โœ… Configured Tauri Mobile CI builds .apk (see setup)
iOS โœ… Configured Tauri Mobile CI builds .ipa (see setup)
Chrome Extension โœ… Ready WXT + React + WASM Load unpacked (see setup)
WeChat Mini Program โœ… Ready Taro 4 + React Import to WeChat DevTools (see setup)

Architecture

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚  json-core  โ”‚  (Rust library)
                         โ”‚  10 tools   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚                 โ”‚                  โ”‚
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚   WASM      โ”‚  โ”‚    Tauri      โ”‚  โ”‚  Pure JS    โ”‚
       โ”‚ (wasm-pack) โ”‚  โ”‚  (native)     โ”‚  โ”‚ (fallback)  โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚                 โ”‚                  โ”‚
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚               โ”‚  โ”‚            โ”‚    โ”‚             โ”‚
 โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ” โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ” โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”
 โ”‚ Web SPA โ”‚  โ”‚ Chrome   โ”‚ โ”‚ โ”‚ macOS App โ”‚ โ”‚ โ”‚ Mini Programโ”‚
 โ”‚ (Vite)  โ”‚  โ”‚ Extensionโ”‚ โ”‚ โ”‚ Win/Linux โ”‚ โ”‚ โ”‚ (Taro)      โ”‚
 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ Android   โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚ โ”‚ iOS       โ”‚ โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
              โ””โ”€ Mobile uses Tauri native โ”€โ”˜

Key design: The Rust json-core crate compiles to both WASM (for web/extension) and native (for Tauri desktop/mobile). A platform adapter auto-detects the environment and routes calls accordingly. The mini program uses a pure JS fallback since WASM support is limited in that environment.

Project Structure

json-toolkit/
โ”œโ”€โ”€ crates/json-core/        # Shared Rust core (10 JSON tools + WASM bindings)
โ”œโ”€โ”€ src-tauri/               # Tauri desktop + mobile app
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ main.rs          # Entry point
โ”‚   โ”‚   โ”œโ”€โ”€ lib.rs           # Tauri app setup
โ”‚   โ”‚   โ””โ”€โ”€ commands.rs      # 12 Tauri commands wrapping json-core
โ”‚   โ”œโ”€โ”€ Cargo.toml           # Tauri dependencies
โ”‚   โ”œโ”€โ”€ tauri.conf.json      # Tauri config (desktop + mobile)
โ”‚   โ””โ”€โ”€ capabilities/        # Tauri 2.0 capability configs
โ”œโ”€โ”€ web/                     # Web app (Vite + React + TailwindCSS)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.tsx          # Main app with sidebar + tool routing
โ”‚   โ”‚   โ”œโ”€โ”€ tools/           # 10 tool components
โ”‚   โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ adapter.ts   # Platform adapter (WASM vs Tauri)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ types.ts     # Shared TypeScript types
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ tools.ts     # Tool metadata + categories
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ i18n.ts      # Chinese/English translations
โ”‚   โ”‚   โ”œโ”€โ”€ components/      # Shared UI components
โ”‚   โ”‚   โ”œโ”€โ”€ store.ts         # Zustand state (theme, lang, history)
โ”‚   โ”‚   โ””โ”€โ”€ wasm/            # Generated WASM output (gitignored)
โ”‚   โ”œโ”€โ”€ vite.config.ts
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ extension/               # Chrome Extension (WXT + React + WASM)
โ”‚   โ”œโ”€โ”€ entrypoints/
โ”‚   โ”‚   โ”œโ”€โ”€ popup/           # 400ร—500 popup with 4 quick tools
โ”‚   โ”‚   โ”œโ”€โ”€ sidepanel/       # Full side panel with all 9 tools
โ”‚   โ”‚   โ”œโ”€โ”€ background.ts    # Service worker
โ”‚   โ”‚   โ””โ”€โ”€ content.ts       # Auto-detect JSON on pages
โ”‚   โ”œโ”€โ”€ utils/wasm.ts        # WASM loader via chrome.runtime
โ”‚   โ”œโ”€โ”€ wasm/                # Copied WASM files (gitignored)
โ”‚   โ”œโ”€โ”€ wxt.config.ts        # WXT config with manifest
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ miniprogram/             # WeChat Mini Program (Taro 4 + React)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ index/       # Main page (tool grid + input/output)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ result/      # Result display page
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ about/       # About page
โ”‚   โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ jsonTools.ts # Pure JS implementation (7 tools)
โ”‚   โ”‚   โ”œโ”€โ”€ app.ts           # App entry
โ”‚   โ”‚   โ”œโ”€โ”€ app.config.ts    # Pages + tabBar config
โ”‚   โ”‚   โ””โ”€โ”€ app.css          # Global styles
โ”‚   โ”œโ”€โ”€ config/index.ts      # Taro build config
โ”‚   โ”œโ”€โ”€ project.config.json  # WeChat DevTools config
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ .github/workflows/
โ”‚   โ”œโ”€โ”€ ci.yml               # Rust tests + web build (on push/PR)
โ”‚   โ”œโ”€โ”€ deploy-web.yml       # Deploy to GitHub Pages (on push to main)
โ”‚   โ”œโ”€โ”€ build-desktop.yml    # Build macOS/Win/Linux (on tag push)
โ”‚   โ”œโ”€โ”€ build-mobile.yml     # Build Android/iOS (on tag push)
โ”‚   โ””โ”€โ”€ build-extension.yml  # Build Chrome Extension (on tag push)
โ”œโ”€โ”€ Cargo.toml               # Rust workspace root
โ”œโ”€โ”€ package.json             # pnpm workspace root (all scripts)
โ”œโ”€โ”€ pnpm-workspace.yaml      # Workspace: web + extension + miniprogram
โ””โ”€โ”€ rust-toolchain.toml      # Rust toolchain config

Getting Started

Prerequisites

  • Rust 1.75+ (rustup)
  • Node.js 20+ and pnpm 10+
  • wasm-pack (curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh)
  • Android Studio (for Android builds only)
  • Xcode (for iOS builds only, macOS only)
  • WeChat DevTools (for mini program only)

Quick Start

# Clone
git clone https://github.com/junhey/json-toolkit.git
cd json-toolkit

# Install dependencies
pnpm install

# Build WASM core (required before first run)
pnpm wasm:build

# Run web dev server
pnpm dev:web          # โ†’ http://localhost:5173

# Run Tauri desktop dev (macOS)
pnpm dev:tauri        # โ†’ opens desktop window

# Run tests
pnpm test:rust        # โ†’ 37 Rust unit tests

Platform Guide

Web

Already deployed to GitHub Pages: https://junhey.github.io/json-toolkit/

# Dev
pnpm dev:web

# Build for production
pnpm build:web

# Build for GitHub Pages (uses /json-toolkit/ base path)
GITHUB_PAGES=true pnpm --filter web build

Deployment is automatic โ€” pushing to main triggers the deploy-web.yml workflow.

Desktop (macOS / Windows / Linux)

# Dev (macOS)
pnpm dev:tauri

# Build for current platform
pnpm build:tauri
# Output: src-tauri/target/release/bundle/

# Cross-compile (macOS only)
pnpm build:tauri -- --target aarch64-apple-darwin  # Apple Silicon
pnpm build:tauri -- --target x86_64-apple-darwin   # Intel

CI builds: Push a v* tag to trigger automatic builds for all desktop platforms:

git tag v0.2.0
git push origin v0.2.0
# โ†’ GitHub Actions builds .dmg (macOS), .msi (Windows), .deb (Linux)

Linux prerequisites:

sudo apt install libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf

Android / iOS

Tauri Mobile uses the same React frontend and Rust core, packaged as a native mobile app.

One-time setup:

# Android: Install Android Studio + NDK + set ANDROID_HOME
# https://tauri.app/start/prerequisites/#android

# iOS: Install Xcode (macOS only)
# https://tauri.app/start/prerequisites/#ios

# Initialize mobile projects (generates src-tauri/gen/)
pnpm tauri android init
pnpm tauri ios init

Development:

# Android dev (requires Android emulator or device)
pnpm dev:android

# iOS dev (requires iOS Simulator or device)
pnpm dev:ios

Build:

# Build Android APK
pnpm build:android
# Output: src-tauri/gen/android/app/build/outputs/apk/

# Build iOS (requires Apple Developer account for device builds)
pnpm build:ios
# Output: src-tauri/gen/apple/build/Release-iphoneos/

CI builds: The build-mobile.yml workflow runs on tag push. Android builds on Ubuntu, iOS builds on macOS. Both use continue-on-error: true since mobile builds may fail without proper signing keys.

Chrome Extension

Built with WXT framework โ€” modern WebExtension development with Vite.

Features:

  • Popup (400ร—500): Quick access to Format, Minify, Sort, JSONPath
  • Side Panel: Full workspace with all 9 tools
  • Content Script: Auto-detects JSON on web pages, shows badge
  • Powered by WASM: Uses the same Rust core compiled to WASM

Build:

# Build WASM + copy to extension
pnpm wasm:build
pnpm wasm:copy-ext

# Build extension
pnpm build:extension
# Output: extension/.output/chrome-mv3/

Load in Chrome:

  1. Run pnpm build:extension
  2. Open chrome://extensions/
  3. Enable Developer mode (top right)
  4. Click Load unpacked
  5. Select the extension/.output/chrome-mv3/ directory
  6. The JSON Toolkit icon appears in your toolbar

Dev mode:

pnpm dev:extension    # โ†’ WXT dev mode with hot reload

CI builds: Push a v* tag to build and package the extension as a .zip for Chrome Web Store submission.

WeChat Mini Program

Built with Taro 4 โ€” cross-platform mini program framework.

Features:

  • 7 tools: Format, Minify, Sort, Decode, JSONPath, Validate, CSV
  • Pure JS implementation (WASM not directly available in MP runtime)
  • TabBar navigation: Tools + About
  • Chinese UI optimized for mobile

Note: WeChat Mini Programs have limited WASM support. This implementation uses a pure JavaScript fallback that handles all core operations. To integrate WASM, see WeChat WASM docs.

Build:

# Install miniprogram dependencies
pnpm --filter miniprogram install

# Build for WeChat
pnpm build:miniprogram
# Output: miniprogram/dist/

Import to WeChat DevTools:

  1. Run pnpm build:miniprogram
  2. Open WeChat DevTools (ๅพฎไฟกๅผ€ๅ‘่€…ๅทฅๅ…ท)
  3. Select Import project (ๅฏผๅ…ฅ้กน็›ฎ)
  4. Choose the miniprogram/ directory
  5. Set your AppID (or use test AppID)
  6. The project loads with the built files in miniprogram/dist/

Dev mode:

pnpm dev:miniprogram    # โ†’ Watch mode, rebuilds on file change

CI/CD

Workflow Trigger What it does
ci.yml Push to main/PR Rust tests + WASM build + Web build verification
deploy-web.yml Push to main Build web โ†’ Deploy to GitHub Pages
build-desktop.yml Tag v* push Build macOS (.dmg), Windows (.msi), Linux (.deb)
build-mobile.yml Tag v* push Build Android (.apk) + iOS (.ipa)
build-extension.yml Tag v* push Build Chrome Extension (.zip)

Release flow:

# 1. Update version in package.json and src-tauri/tauri.conf.json
# 2. Commit and push
git commit -am "release: v0.2.0"
git push

# 3. Create tag
git tag v0.2.0
git push origin v0.2.0

# 4. GitHub Actions builds all platforms automatically
# โ†’ Draft release with all artifacts attached

Tech Stack

Layer Technology
Core Rust, serde_json, jsonpath_lib, jsonschema, csv, base64
Desktop/Mobile Tauri 2.0 (macOS, Windows, Linux, Android, iOS)
Web Vite, React 18, TypeScript, TailwindCSS
Extension WXT, React, Chrome Manifest V3
Mini Program Taro 4, React
Bridge wasm-pack, wasm-bindgen (Web + Extension)
State Zustand with localStorage persistence
CI/CD GitHub Actions (5 workflows)

Scripts Reference

Command Description
pnpm wasm:build Build Rust core to WASM
pnpm wasm:copy-ext Copy WASM files to extension dir
pnpm dev:web Web dev server (port 5173)
pnpm dev:tauri Tauri desktop dev
pnpm dev:android Android dev (needs SDK)
pnpm dev:ios iOS dev (needs Xcode)
pnpm dev:extension Chrome extension dev with HMR
pnpm dev:miniprogram Mini program dev with watch
pnpm build:web Build web for production
pnpm build:tauri Build desktop app
pnpm build:android Build Android APK
pnpm build:ios Build iOS app
pnpm build:extension Build Chrome extension
pnpm build:miniprogram Build WeChat mini program
pnpm test:rust Run 37 Rust unit tests

License

MIT

About

JSON Toolkit - A powerful JSON toolbox built with Rust + Tauri. Format, minify, sort, decode, JSONPath, tree view, table view, diff, schema validation, CSV conversion.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages