JsonSerializable (interface)

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 mixed jsonSerialize ( void )

}

Table of Contents

  • JsonSerializable::jsonSerialize — Specify data which should be serialized to JSON

← Predefined Constants

JsonSerializable::jsonSerialize →

© 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

https://secure.php.net/manual/en/class.jsonserializable.php