<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Easy JSON Encoding/Decoding in PHP</title>
	<atom:link href="http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/feed" rel="self" type="application/rss+xml" />
	<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php</link>
	<description>He is no fool who gives what he cannot keep to gain that which he cannot lose.  &#160;&#160;&#160; -Jim Elliot</description>
	<lastBuildDate>Thu, 17 May 2012 00:41:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Doug</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-49588</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Mon, 22 Mar 2010 20:33:15 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-49588</guid>
		<description>No one has mentioned that these are not core PHP functions. In order to get the JSON functions to work in PHP, you will have to install the JSON PECL PHP extension.</description>
		<content:encoded><![CDATA[<p>No one has mentioned that these are not core <span class="caps">PHP </span>functions. In order to get the <span class="caps">JSON </span>functions to work in <span class="caps">PHP, </span>you will have to install the <span class="caps">JSON PECL PHP </span>extension.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cuong</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-41520</link>
		<dc:creator>Cuong</dc:creator>
		<pubDate>Sat, 19 Sep 2009 19:25:05 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-41520</guid>
		<description>The main advantage of JSON format to me, as a web developer, is the simplicity of exchanging data in Ajax based interaction. What I normally do is at the server side bundle all the data in a PHP array, encode the array in JSON format, and output it. At client side, decode the output by the PHP script into an JavaScript object. 

For more information see http://www.json.org/js.html.


After the release PHP 5.2, I only use PHP build-in function 
json_encode for mostly all my JSON encoding needs. As far as I can recall, I have never used json_decode in PHP.</description>
		<content:encoded><![CDATA[<p>The main advantage of <span class="caps">JSON </span>format to me, as a web developer, is the simplicity of exchanging data in Ajax based interaction. What I normally do is at the server side bundle all the data in a <span class="caps">PHP </span>array, encode the array in <span class="caps">JSON </span>format, and output it. At client side, decode the output by the <span class="caps">PHP </span>script into an JavaScript object. </p>
<p>For more information see <a href="http://www.json.org/js.html." rel="nofollow">http://www.json.org/js.html.</a></p>
<p>After the release <span class="caps">PHP</span> 5.2, I only use <span class="caps">PHP </span>build-in function <br />
json_encode for mostly all my <span class="caps">JSON </span>encoding needs. As far as I can recall, I have never used json_decode in <span class="caps">PHP.</span></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Web Design Bermuda</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-41399</link>
		<dc:creator>Web Design Bermuda</dc:creator>
		<pubDate>Thu, 17 Sep 2009 13:56:23 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-41399</guid>
		<description>I do not understand how this demonstrates an advantage.  It is easy to JSON encode simple strings like above.

Does Zend help with JSON encoding HTML or strings that need lots of escape characters.

I am having a really tough time right now JSON encoding a string of HTML with a checkbox array.  The checkbox array contains square brackets which throw off the JSON.  

How would Zend help me deal with this?</description>
		<content:encoded><![CDATA[<p>I do not understand how this demonstrates an advantage.  It is easy to <span class="caps">JSON </span>encode simple strings like above.</p>
<p>Does Zend help with <span class="caps">JSON </span>encoding <span class="caps">HTML </span>or strings that need lots of escape characters.</p>
<p>I am having a really tough time right now <span class="caps">JSON </span>encoding a string of <span class="caps">HTML </span>with a checkbox array.  The checkbox array contains square brackets which throw off the <span class="caps">JSON.  </span></p>
<p>How would Zend help me deal with this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tracy</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-36938</link>
		<dc:creator>Tracy</dc:creator>
		<pubDate>Wed, 17 Jun 2009 04:25:37 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-36938</guid>
		<description>I&#039;m trying to decode a JSON string into a PHP array.  The JSON string is stored in a PHP variable.  How do I format this line: $result = Zend_Json::decode( &#039;{&quot;wine&quot;:3,&quot;sugar&quot;:4,&quot;lemon&quot;:22}&#039;);
to use the variable containing the JSON string?

Thanks!</description>
		<content:encoded><![CDATA[<p>I'm trying to decode a <span class="caps">JSON </span>string into a <span class="caps">PHP </span>array.  The <span class="caps">JSON </span>string is stored in a <span class="caps">PHP </span>variable.  How do I format this line: $result = Zend_Json::decode( '<a href="http://3,"sugar":4,"lemon":22">wine</a>');<br />
to use the variable containing the <span class="caps">JSON </span>string?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-25183</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Wed, 10 Dec 2008 17:01:29 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-25183</guid>
		<description>Hi thanks for your help. I got the same error, updatet php and now it is working.

Thx.</description>
		<content:encoded><![CDATA[<p>Hi thanks for your help. I got the same error, updatet php and now it is working.</p>
<p>Thx.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: darksama</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-7398</link>
		<dc:creator>darksama</dc:creator>
		<pubDate>Fri, 11 Apr 2008 06:22:13 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-7398</guid>
		<description>It sounds good, I love the simplicity. Your posts are easy as a pie and really attractive at the same time.</description>
		<content:encoded><![CDATA[<p>It sounds good, I love the simplicity. Your posts are easy as a pie and really attractive at the same time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: YUI Based Lightbox - Revisited : Code Central</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-5342</link>
		<dc:creator>YUI Based Lightbox - Revisited : Code Central</dc:creator>
		<pubDate>Thu, 13 Mar 2008 07:23:40 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-5342</guid>
		<description>[...] Easy JSON Encoding/Decoding in PHP [...]</description>
		<content:encoded><![CDATA[<p>[...] Easy <span class="caps">JSON</span> Encoding/Decoding in <span class="caps">PHP </span>[...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cuong</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-3820</link>
		<dc:creator>Cuong</dc:creator>
		<pubDate>Mon, 21 Jan 2008 23:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-3820</guid>
		<description>Both perform essentially the same thing. The only catch is that json_decode is not available in PHP prior to version 5.20.</description>
		<content:encoded><![CDATA[<p>Both perform essentially the same thing. The only catch is that json_decode is not available in <span class="caps">PHP </span>prior to version 5.20.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-3818</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Mon, 21 Jan 2008 23:37:48 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-3818</guid>
		<description>So what does the Zend class do that the native PHP json_encode and json_decode functions don&#039;t? (Apart from being available in an earlier version of PHP)</description>
		<content:encoded><![CDATA[<p>So what does the Zend class do that the native <span class="caps">PHP </span>json_encode and json_decode functions don't? (Apart from being available in an earlier version of <span class="caps">PHP</span>)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cuong</title>
		<link>http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php/comment-page-1#comment-2516</link>
		<dc:creator>Cuong</dc:creator>
		<pubDate>Mon, 24 Dec 2007 20:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://thecodecentral.com/2007/09/13/easy-json-encodingdecoding-in-php#comment-2516</guid>
		<description>Sorry your earlier comment was placed to moderation. I see what you are trying to do now.

Apparently this is a JSONP request. You have to wrap your entire JSON response with the callback you specified in the URL, which is &quot;callback&quot; in this case:

&lt;pre&gt;
callback( {&quot;job_Description&quot;:&quot;My Job&quot;,&quot;job_Notes&quot;:&quot;My jobs notes are here.&quot;} )
&lt;/pre&gt;

http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/


If cross-site scripting is not required, you can simply change this line from 
&lt;pre&gt;
var url = &quot;http://127.0.0.1/projects/client_api/test?callback=?&quot;;
&lt;/pre&gt;
to
&lt;pre&gt;
var url = &quot;http://127.0.0.1/projects/client_api/test&quot;;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Sorry your earlier comment was placed to moderation. I see what you are trying to do now.</p>
<p>Apparently this is a <span class="caps">JSONP </span>request. You have to wrap your entire <span class="caps">JSON </span>response with the callback you specified in the <span class="caps">URL, </span>which is "callback" in this case:</p>
<pre>
callback( {&quot;job_Description&quot;:&quot;My Job&quot;,&quot;job_Notes&quot;:&quot;My jobs notes are here.&quot;} )
</pre>
<p><a href="http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/" rel="nofollow">http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/</a></p>
<p>If cross-site scripting is not required, you can simply change this line from </p>
<pre>
var url = &quot;<a href="http://127.0.0.1/projects/client_api/test?callback=?&quot;" rel="nofollow">http://127.0.0.1/projects/client_api/test?callback=?&quot;</a>;
</pre>
<p>to</p>
<pre>
var url = &quot;<a href="http://127.0.0.1/projects/client_api/test&quot;" rel="nofollow">http://127.0.0.1/projects/client_api/test&quot;</a>;
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

