Added default null to clientmessage

This commit is contained in:
Franklin 2023-02-21 16:20:35 -04:00
parent 5fbaaa78b1
commit 5dc72469a7
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,10 @@ use serde_json::Value;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct ClientMessage {
pub head: String,
#[serde(skip_serializing_if = "Value::is_null")]
#[serde(skip_serializing_if = "Value::is_null", default = "null_value")]
pub body: Value,
}
fn null_value() -> Value {
Value::Null
}