| Crates.io | kyori-component-json |
| lib.rs | kyori-component-json |
| version | 0.2.1 |
| created_at | 2025-05-19 09:48:30.018734+00 |
| updated_at | 2025-08-17 22:58:30.555021+00 |
| description | A library for serializing and deserializing Kyori Component JSON content |
| homepage | |
| repository | https://github.com/walker84837/kyori-component-json |
| max_upload_size | |
| id | 1679525 |
| size | 75,756 |
Minecraft text formatting made easy
A simple Rust library for creating and working with Minecraft's JSON text components (Java Edition 1.21.5+). This is the same system used in commands like /tellraw, books, signs, and more!
Mainly:
But it also empowers you to:
/tellraw or /title commands programmaticallyuse kyori_component_json::*;
let message = Component::text("Hello Minecraft!")
.color(Some(Color::Named(NamedColor::Red)))
.decoration(TextDecoration::Bold, Some(true));
// Use in /tellraw command:
// /tellraw @a {"text":"Hello Minecraft!","color":"red","bold":true}
let clickable = Component::text("Click me!")
.click_event(Some(ClickEvent::RunCommand {
command: "/say Hello!".into()
}))
.hover_event(Some(HoverEvent::ShowText {
value: Component::text("This will run a command!")
}));
let combined = Component::text("Welcome, ")
.append(
Component::text("Player")
.color(Some(Color::Named(NamedColor::Gold)))
.append_newline()
.append(clickable); // From previous example
// Create a formatted message with multiple parts
let message = Component::text("Server Notice: ")
.color(Some(Color::Named(NamedColor::Red)))
.append(
Component::text("Important update!")
.color(Some(Color::Named(NamedColor::Gold)))
.append_newline()
.append(
Component::text("Click for details")
.click_event(Some(ClickEvent::RunCommand {
command: "/update".into()
}))
.hover_event(Some(HoverEvent::ShowText {
value: Component::text("Run /update command")
}))
);
// Convert to Minecraft JSON
let json = serde_json::to_string(&message).unwrap();
cargo doc --open --no-depsThis project is licensed under either of
at your option.
Contributions are welcome! Please feel free to submit a pull request.