An interactive JSON tree visualiser for egui, with search and highlight functionality.

Overview

egui_json_tree

An interactive JSON tree visualiser for egui, with search and highlight functionality.

Search Example

Usage

use egui::{Color32};
use egui_json_tree::{DefaultExpand, JsonTree, JsonTreeStyle};

let value = serde_json::json!({ "foo": "bar", "fizz": [1, 2, 3]});

let response = JsonTree::new("globally-unique-id", &value)
    .style(JsonTreeStyle {
        bool_color: Color32::YELLOW,
        ..Default::default()
    })
    .default_expand(DefaultExpand::All)
    .response_callback(|response, json_pointer_str| {
      // Handle interactions within the JsonTree.
    })
    .show(ui);

// Reset the expanded state of all arrays/objects to respect the `default_expand` setting.
response.reset_expanded(ui);

See demo.rs and run the examples for more detailed use cases, including the search match highlight/auto expand functionality, and how to copy JSON paths and values to the clipboard.

JsonTree can visualise any type that implements Into<JsonTreeValue>. An implementation to support serde_json::Value is provided with this crate. If you wish to use a different JSON type, see the value module, and disable default features in your Cargo.toml if you do not need the serde_json dependency.

Run Examples

cargo run --example=demo

Open Docs

cargo doc --no-deps --open

Notes

This crate currently depends on an unpublished version of egui from the master branch, in order to expose the ability to reset the expanded state of arrays/objects in a JsonTree. On the next egui release, this crate will update its egui dependency to the latest published version, and this crate will be published to crates.io.

You might also like...
Egui bindings for macroquad

egui bindings for macroquad This is the easiest way to use egui. Just two functions! Web demo. Usage You need to call ui when you need to get informat

Egui bindings for miniquad

egui bindings for miniquad native On Linux you first must run apt install libx11-dev libxi-dev libgl1-mesa-dev (miniquad dependencies). cargo run --re

Render egui with skia!

Skia backend for egui This is a drawing backend for egui that uses skia-safe. Usage Have a look at the metal or cpu examples to get started. Run the e

a day-planner/calendar app based on egui
a day-planner/calendar app based on egui

Malakal Malakal is a day planner application. I crafted it because I was not able to find a comfortable calendar application for Linux. I myself have

A render-backend independant egui backend for sdl2

A Sdl2 + Egui Backend An egui backend for sdl2 unbound to any renderer-backend. You can include it like so: [dependencies] egui_sdl2_platform = "0.1.0

egui backend for D3D9.

egui-d3d9 egui backend for D3D9. Primarily intended for source games like CS:GO and GMod. It's not perfect by far, but it'll do. This is a rewrite of

A tool for creating egui Visuals (themes).

egui-visuals-utility A tool for creating egui Visuals (themes). The code is rather messy and might crash but it seems to work. To load the theme use s

Create dynamic grid-based layouts for egui

egui_grid Create dynamic grid layouts for egui. Grids are flexible, easy to create, with behavior similar to egui_extra's strip creation. They're comp

Provides event handling for egui in SDL2 window applications.

egui-sdl2-event Provides event handling for egui when SDL2 is used as the windowing system. This crate does not perform any rendering, but it can be c

Comments
  • Rendering refactor, builder pattern, response callback

    Rendering refactor, builder pattern, response callback

    • Refactor to use LayoutJob instead of Vec<RichText> for rendering.
    • Introduces JsonTreeBuilder for constructing and showing a JsonTree.
    • Adds response callback to handle interactions within the JsonTree.
    opened by dmackdev 0
  • Expose `egui::Response` and JSON path in `JsonTreeResponse`

    Expose `egui::Response` and JSON path in `JsonTreeResponse`

    • Adds pub inner: Option<(Response, String)> field to JsonTreeResponse.
    • Adds CopyToClipboard example to demonstrate use of the Response and path for copying JSON paths and values to clipboard.
    • Shows all labels as monospace.
    • Adds pub punctuation_color: Color32 field to JsonTreeStyle.
    • Captures responses for spaces, commas, colons and collapsed expandables.
    opened by dmackdev 0
  • Implement search and highlight

    Implement search and highlight

    • Adds search functionality via Expand::SearchResults(String) enum variant. Matching search results of object keys and values, and array elements, will be visible by expanding all parent arrays/objects.
    • Search term matches are highlighted.
    • Adds JsonTree::reset_expanded method to reset expanded state of all arrays/objects to respect the default_expand value. Note: Relies on my fork of egui to provide functionality to remove CollapsedState from egui memory.
    opened by dmackdev 0
Owner
null
A presentation about egui, implemented in egui

egui presentation A presentation about egui, implemented in egui. You can view the presentation at https://emilk.github.io/egui_presentation/. TODO Li

Emil Ernerfeldt 9 Aug 24, 2023
A tongue-in-cheek GUI that provides similar functionality to GNU cat

catboy a tongue-in-cheek GUI that provides similar functionality to GNU cat information: Attribute Value Development Status: Active Neglect Price: I h

toasterrepairman 2 Feb 9, 2022
Provides core language-agnostic functionality for LiveView Native across platforms

LiveView Native Core This repository contains an implementation of the LiveView Native core library, which is intended to handle all the details which

LiveView Native 35 Dec 27, 2022
Example showing how to use tokio and egui together.

Example using tokio with egui This example uses reqwest to send an HTTP request to httpbin. The parsed response contains an increment value (as provid

Jay Oster 10 Dec 25, 2022
egui port to Car Thing (and maybe an alternative Car Thing UI?)

tt This project contains a port of egui to the Spotify Car Thing although in the future I also plan for it to contain a custom Car Thing UI. Technical

Andy Bao 7 Dec 30, 2022
This project attempts to allow the creation of reusable egui-themes

egui stylist Note this project is considered to be experimental and -- while used in personal projects -- may have API breaking changes without warnin

Jacobsky 22 Dec 1, 2022
A simple GUI version of the pH calibration tool written in egui, based on the eframe template.

caliphui A simple GUI version of the pH calibration tool written in egui, based on the eframe template. Usage Native binaries are provided under relea

Peter Dunne 0 Dec 29, 2021
FLTK frontend for Egui WGPU backend.

Egui FLTK Frontend FLTK Frontend for Egui WGPU Backend On linux Debian/Ubuntu, make sure to install the latest main requirements: sudo apt-get update

Adia Robbie 5 Oct 25, 2022
egui: an easy-to-use immediate mode GUI in pure Rust

?? egui: an easy-to-use GUI in pure Rust egui is a simple, fast, and highly portable immediate mode GUI library for Rust. egui runs on the web, native

Emil Ernerfeldt 12.6k Jan 3, 2023
D3D11 backend for egui library. Presumably for mods/cheats development

D3D11 backend for egui library. Presumably for mods/cheats development. Currently few features from egui are missing. WIP.

sy1ntexx 24 Jan 4, 2023