The JsonSerializable interface

Introduction

(PHP 5 >= 5.4.0, PHP 7)

Objects implementing JsonSerializable can customize their JSON representation when encoded with json_encode().

Interface synopsis

JsonSerializable {
/* Methods */
abstract public jsonSerialize ( ) : mixed
}

Table of Contents

© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.jsonserializable.php