From e63b86ddad694073029e33bb54296f3c2b3375be Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 27 Dec 2025 08:41:22 -1345 Subject: don't serialize 'extra' twice in FormattedText --- CHANGELOG.md | 2 ++ azalea-chat/src/text_component.rs | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25fff077..33037c51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ is breaking anyways, semantic versioning is not followed. ### Fixed +- Serializing `FormattedText` with serde was writing `extra` twice. + ## [0.15.0+mc1.21.11] - 2025-12-18 ### Added diff --git a/azalea-chat/src/text_component.rs b/azalea-chat/src/text_component.rs index ec89a7c9..41f03965 100644 --- a/azalea-chat/src/text_component.rs +++ b/azalea-chat/src/text_component.rs @@ -28,9 +28,6 @@ impl Serialize for TextComponent { self.base.serialize_map::(&mut state)?; - if !self.base.siblings.is_empty() { - state.serialize_entry("extra", &self.base.siblings)?; - } state.end() } } @@ -254,4 +251,13 @@ mod tests { ) ); } + + #[test] + fn test_serialize_to_json() { + let component = TextComponent::new("Hello §aworld".to_owned()).get(); + assert_eq!( + serde_json::to_string(&component).unwrap(), + "{\"text\":\"\",\"extra\":[\"Hello \",{\"text\":\"world\",\"color\":\"#55FF55\"}]}" + ); + } } -- cgit v1.2.3