Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
192 changes: 192 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# JSONMind - JSON Visualization Tool

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Transform JSON data into interactive mind maps for better visualization and understanding.

![JSONMind Screenshot](https://github.com/user-attachments/assets/3af4484a-7e32-4560-9a17-579553552ce5)

## 🌟 Features

- **Visual JSON Representation**: Automatically converts JSON data into intuitive mind map structures
- **Real-time Synchronization**: Bidirectional sync between JSON editor and mind map visualization
- **Type-based Color Coding**: Different colors for different data types
- 🟢 **Green**: String values
- 🔵 **Blue**: Number values
- 🟠 **Orange**: Boolean values
- ⚪ **Grey**: Null values
- 🟡 **Orange Container**: Object nodes
- 🔵 **Blue Container**: Array nodes
- **Split Node Design**: Combined key-value display for primitive types
- **Interactive Navigation**: Zoom in/out, pan, and center content
- **JSON Validation**: Real-time JSON syntax checking with error messages
- **Format JSON**: One-click JSON beautification

## 🚀 Getting Started

### Prerequisites

- Node.js (v16 or higher)
- npm or yarn

### Installation

1. Clone the repository:
```bash
git clone https://github.com/HoChihchou/JSONMind.git
cd JSONMind
```

2. Install dependencies:
```bash
npm install
```

3. Start the development server:
```bash
npm run dev
```

4. Open your browser and navigate to `http://localhost:5173`

### Building for Production

```bash
npm run build
```

The built files will be in the `dist` directory.

## 📖 Usage

1. **Edit JSON**: Type or paste JSON data in the left editor panel
2. **Auto-visualization**: The mind map updates automatically as you type
3. **Format**: Click "Format JSON" to beautify your JSON
4. **Navigate**: Use zoom controls to explore large JSON structures
5. **Validate**: Check for syntax errors with real-time validation

### Example JSON

```json
{
"name": "JSONMind",
"version": "1.0.0",
"author": "Developer",
"license": "MIT",
"features": ["visualization", "editing"],
"status": "active",
"count": 42,
"enabled": true
}
```

## 🏗️ Architecture

### Technology Stack

- **Frontend Framework**: React 19.2 + TypeScript 5.9

Copilot AI Dec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README claims to use 'React 19.2' but this version doesn't exist as of January 2025. Update the documentation to match the actual React version being used, or correct the package.json to use a valid React version.

Suggested change
- **Frontend Framework**: React 19.2 + TypeScript 5.9
- **Frontend Framework**: React + TypeScript 5.9

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a2a5f1a. Updated to just "React" without specific version number.

- **State Management**: Zustand 4.4
- **Graph Visualization**: AntV X6 2.18
- **Build Tool**: Vite 7.x

Copilot AI Dec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README claims to use 'Vite 7.x' but this version doesn't exist as of January 2025. Update the documentation to match the actual Vite version being used (likely 5.x), or correct the package.json to use a valid Vite version.

Suggested change
- **Build Tool**: Vite 7.x
- **Build Tool**: Vite 5.x

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a2a5f1a. Updated to "Vite 5.x" to match actual version.

- **UI Components**: Ant Design 5.x

### Project Structure

```
src/
├── components/ # React components
│ ├── Editor/ # JSON editor component
│ ├── MindMap/ # Mind map visualization
│ └── Layout/ # Layout components
├── core/ # Core logic
│ ├── parser.ts # JSON parser
│ └── transformer.ts # Data transformer
├── store/ # State management
│ └── appStore.ts # Zustand store
├── types/ # TypeScript types
│ ├── node.ts # Node types
│ └── graph.ts # Graph types
└── utils/ # Utility functions
```

### Key Design Patterns

- **Unidirectional Data Flow**: JSON → Parser → Tree Model → Graph Data → Visualization
- **Type Safety**: Strong TypeScript typing throughout the codebase
- **Component Composition**: Modular, reusable React components
- **Custom Node Rendering**: Specialized nodes for different data types

## 🎨 Visual Design

The application follows the design specifications from the PRD:

- **Horizontal Layout**: Root node on the left, children extend to the right
- **Symmetric Distribution**: Balanced vertical spacing
- **Container Nodes**: Show type icon ({} or []) and key name
- **Split Nodes**: Left side (grey) shows key, right side (colored) shows value with type icon

## 🔧 Development

### Available Scripts

- `npm run dev` - Start development server
- `npm run build` - Build for production
- `npm run preview` - Preview production build
- `npm run lint` - Run ESLint

### Code Quality

The project uses:
- **TypeScript** for type safety
- **ESLint** for code linting
- **Vite** for fast development and building

## 📋 Roadmap

### Current Features (v1.0)
- ✅ JSON parsing and validation
- ✅ Mind map visualization
- ✅ Bidirectional synchronization
- ✅ Type-based color coding
- ✅ Zoom and pan controls
- ✅ Format JSON

### Future Enhancements (v2.0)
- [ ] Node editing (double-click to edit values)
- [ ] Add/delete nodes
- [ ] Drag and drop for arrays
- [ ] Undo/redo functionality
- [ ] Export to PNG/SVG
- [ ] Export to JSON file
- [ ] Keyboard shortcuts
- [ ] Dark mode
- [ ] Lazy loading for large JSON files
- [ ] Search and filter

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the project
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## 📄 License

This project is licensed under the MIT License.

## 🙏 Acknowledgments

- Based on the technical specifications in [技术方案.md](./技术方案.md)
- Inspired by the need for better JSON visualization tools
- Built with modern web technologies

## 📞 Contact

Project Link: [https://github.com/HoChihchou/JSONMind](https://github.com/HoChihchou/JSONMind)

---

Made with ❤️ for developers who work with JSON
23 changes: 23 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'

Copilot AI Dec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import statement 'from eslint/config' doesn't match the standard ESLint API. The correct import should be from 'eslint' or use a direct configuration object instead of defineConfig and globalIgnores from 'eslint/config'. This may cause the ESLint configuration to fail. Verify that this import path is correct for your version of ESLint, or use the standard configuration format.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a2a5f1a. Removed invalid imports and converted to proper ESLint flat config format.


export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],

Copilot AI Dec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'extends' property is not valid in ESLint flat config format. In flat config, you should spread the configs directly into the array instead of using 'extends'. Replace the extends array with spreading the configurations like: ...js.configs.recommended, ...tseslint.configs.recommended, etc.

Suggested change
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
js.configs.recommended,
...tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
{
files: ['**/*.{ts,tsx}'],

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a2a5f1a. Replaced extends with proper spread syntax for flat config format.

languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
])
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>json-mind</title>

Copilot AI Dec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The page title is 'json-mind' (lowercase with hyphen) which doesn't match the branding used elsewhere in the application ('JSONMind'). Consider changing it to 'JSONMind' for consistency with the header and README.

Suggested change
<title>json-mind</title>
<title>JSONMind</title>

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a2a5f1a. Updated title to "JSONMind" for consistency.

</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading