Native JSON/JSONL Editing with CSV View #217
Grant-Keiter-FHR
started this conversation in
Show and tell
Replies: 1 comment
-
|
Thanks for the input, I appreciate it. Here are some first thoughts on it:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR
Problem: AI generates test data better in JSON format, but humans need tabular CSV views to review large datasets effectively.
Solution: Open JSON files in edit-csv, view/edit as tables, save changes back to JSON automatically.
Key Innovation: Arrays expand vertically (multiple rows) using
.0.notation, keeping columns manageable. Schema preserved via special~DATA_TYPES~row.Status: Working prototype with 121 passing tests on
JSONToCSVbranch. Seeking feedback on this ideaSummary
We propose adding native support for editing JSON and JSONL files through edit-csv's visual table interface. This would allow users to leverage the superior readability of CSV tables for reviewing and editing structured JSON data, while preserving JSON's advantages for programmatic access and AI-assisted data generation.
The Problem
Working with AI-Generated Test Data
When generating test data with AI assistants (ChatGPT, Claude, Copilot, etc.), we've consistently encountered issues with CSV format:
The JSON Advantage (and Limitation)
JSON works significantly better with AI:
However, JSON has a critical usability issue for humans:
The edit-csv Solution
edit-csv already solves the human readability problem for CSV files beautifully. We can see all our data in a table format, quickly scan across rows, and make decisions based on patterns we observe.
What if we could get the best of both worlds?
Proposed Solution
We've implemented a working prototype in the
JSONToCSVbranch that demonstrates this concept with the following features:1. JSON to CSV Conversion with Schema Support
Edit-csv can open JSON files and display them as CSV tables, preserving data type information:
Example JSON Structure (
nested.json):{ "version": "1.0", "schema": { "House": "string", "Owner": "string", "Cars": [ { "Make": "string", "Model": "string", "Doors": "number" } ] }, "rows": [ { "House": "101 Main St", "Owner": "John Doe", "Cars": [ { "Make": "Ford", "Model": "F150", "Doors": 2 } ] }, { "Cars": [ { "Make": "Toyota", "Model": "Camry", "Doors": 4 } ] } ] }Displayed as CSV (in edit-csv):

2. Schema Preservation with
~DATA_TYPES~Row~DATA_TYPES~marker3. Nested Object Flattening with Dot Notation
Nested objects are flattened using standard dot notation:
{ "user": { "address": { "city": "NYC" } } }Becomes CSV columns:
user.address.city4. Array Expansion with
.0.NotationArrays of objects expand vertically instead of creating endless columns:
Key Design Decision: Always use
.0.notation, never.1.or.2..0.indicates the field is part of an array structure, not an array indexWhy Vertical Expansion?
Example:
{ "Owner": "John", "Cars": [ {"Make": "Ford", "Model": "F150"}, {"Make": "Toyota", "Model": "Camry"} ] }Expands to:
Note: "Owner" only appears in the first row because it's not part of the array.
5. Configurable Data Path Extraction
For complex JSON structures, a configuration file (
.vscode/csv-json-config.json) allows pattern-based extraction:{ "patterns": { "financial": { "filePattern": "*.financial.json", "dataPath": "data.transactions", "schemaPath": "metadata.schema" }, "default": { "filePattern": "*", "dataPath": "rows", "schemaPath": "schema" } } }This handles:
6. Bidirectional Sync
Changes made in the CSV view are converted back to proper JSON structure:
schemasectionUse Cases
1. AI-Assisted Test Data Generation
2. API Response Analysis
3. Configuration Management
4. Database Export/Import Workflows
Technical Implementation
The prototype includes:
New Modules:
src/json/jsonEditorModule.ts- Main orchestrationsrc/json/converters/jsonToCsvConverter.ts- JSON → CSVsrc/json/converters/csvToJsonConverter.ts- CSV → JSONsrc/json/configLoader.ts- Pattern-based configurationKey Features:
.0.notationTest Coverage: 121+ tests covering:
Benefits to edit-csv Users
Questions for Discussion
Interest Level: Does this functionality align with edit-csv's vision and roadmap?
Integration Approach:
Notation Standards:
.0.notation intuitive enough for users?Beta Was this translation helpful? Give feedback.
All reactions