Add encode_empty_tables_as_array serialize option.

This will change the behaviour of encoding empty Lua tables into array instead of map.
This commit is contained in:
Alex Orlenko
2025-04-26 17:53:56 +01:00
parent efd192b816
commit 8e1df48e81
4 changed files with 82 additions and 1 deletions
+9
View File
@@ -700,6 +700,15 @@ impl<'a> SerializableValue<'a> {
self.options.sort_keys = enabled;
self
}
/// If true, empty Lua tables will be encoded as array, instead of map.
///
/// Default: **false**
#[must_use]
pub const fn encode_empty_tables_as_array(mut self, enabled: bool) -> Self {
self.options.encode_empty_tables_as_array = enabled;
self
}
}
#[cfg(feature = "serialize")]