Since: 5.4

interface JsonSerializable (View source)

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

Methods

mixed
jsonSerialize()

Specify data which should be serialized to JSON

Details

mixed jsonSerialize()

Since: 5.4

Specify data which should be serialized to JSON

Return Value

mixed

data which can be serialized by json_encode, which is a value of any type other than a resource.