downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

JsonSerializable::jsonSerialize> <Predefined Constants
[edit] Last updated: Fri, 18 May 2012

view this page in

The JsonSerializable interface

(PHP 5 >= 5.4.0)

Introduction

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



add a note add a note User Contributed Notes JsonSerializable
Webdev 28-Apr-2012 05:36
The "encode everything in my class"-Code:

public function jsonSerialize()
{
    return get_object_vars($this);
}

 
show source | credits | sitemap | contact | advertising | mirror sites