<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The JsonSerializable interface</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="json.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="jsonserializable.jsonserialize.html">JsonSerializable::jsonSerialize</a></div> <div class="up"><a href="book.json.html">JSON</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.jsonserializable" class="reference"> <h1 class="title">The JsonSerializable interface</h1> <div class="partintro"><p class="verinfo">(PHP 5 >= 5.4.0)</p> <div class="section" id="jsonserializable.intro"> <h2 class="title">Introduction</h2> <p class="para"> Objects implementing <span class="interfacename"><strong class="interfacename">JsonSerializable</strong></span> can customize their JSON representation when encoded with <span class="function"><a href="function.json-encode.html" class="function">json_encode()</a></span>. </p> </div> <div class="section" id="jsonserializable.synopsis"> <h2 class="title">Interface synopsis</h2> <div class="classsynopsis"> <div class="ooclass"></div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">JsonSerializable</strong> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">abstract</span> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="jsonserializable.jsonserialize.html" class="methodname">jsonSerialize</a></span> ( <span class="methodparam">void</span> )</div> }</div> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="jsonserializable.jsonserialize.html">JsonSerializable::jsonSerialize</a> — Specify data which should be serialized to JSON</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="json.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="jsonserializable.jsonserialize.html">JsonSerializable::jsonSerialize</a></div> <div class="up"><a href="book.json.html">JSON</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>