aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--azalea-chat/src/text_component.rs12
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::<S>(&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\"}]}"
+ );
+ }
}