nmeylan / json-table-editor

A tool to view JSON array as table, to ease visualisation and edition of large json array with performance as main objective
https://jsontable.app
Apache License 2.0
15 stars 3 forks source link
grid json json-editor json-editor-online json-to-table json-viewer json-visualizer rust tool ui

Important

Memory usage: While this tool allow to edit large json file smoothly, it consumes a lot of memory due to technical decision which tradeoff memory in favor of better performance for navigation, edition and serialization. Read below section "Performance and Memory usage" for more details

Web demo

Genesis

I wanted to edit a small json file of 1.5mb, using a table view, javascript based tools like http://json2table.com/# and https://jsongrid.com/json-grid were too slow to edit this file and barely usable, so I decided to attempt to do it myself

Features

Implemented

Usage

Json in video below is 372mb with an array of 309_759 entries, containing nested objects, it runs at ~60fps on an intel graphics chipset (Mesa UHD 630) as only visible cell are rendered

https://github.com/nmeylan/json-table-editor/assets/1909074/6a4f932d-031c-4611-9627-2e2787da5401

view demo video

Performance and Memory usage

This editor use a custom json parser to deserialize json into a flat data structure allowing O(n) data access where n is number of fields of an array element, containing k elements. In general n not bigger than 200 but k can easily be >100000. While it is not the fastest parser on the market, it is still faster to use our custom parser instead of parsing using serde or other library generating tree data structure and then convert it to flat data structure.

As this structure is flat, it also allows to parse only a subset of json files by defining a depth limit, the json files is still fully read but after a given depth, content is not deserialize we only keep raw content as String which then can be parse later, by changing depth.

This mechanism allow fast parsing of big json files, but consume more memory as for each depth level we store the full string and the parsed content. Additionally, this mechanism allow to serialize only row that have been changed, unchanged rows are already serialized, speeding up edition of big files.

Disclaimers

This tool has not yet reached a stable version, thus it has the following limitations:

About

Licence: Apache 2

Credits: this project would not have been possible without egui and its community, and maintainers of dependencies used by this project