diff --git a/src/Model/Message/PushNotification.php b/src/Model/Message/PushNotification.php index b87ab76..216be1d 100644 --- a/src/Model/Message/PushNotification.php +++ b/src/Model/Message/PushNotification.php @@ -87,9 +87,16 @@ public function createMessage(array $options = [], array $auth = []): PushMessag public function jsonSerialize(): array { + $options = []; + foreach ($this->options as $key=>$option) { + if($option !== null){ + $options[$key] = $option; + } + } + return [ - 'title' => $this->title, - 'options' => array_diff($this->options, array_filter($this->options, 'is_null')), + 'title' => $this->title, + 'options' => $options ]; }