<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 22 May 2013 00:38:01 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: PHP Returning Numeric Values in JSON]]></title>
      <guid>http://www.phpdeveloper.org/news/16577</guid>
      <link>http://www.phpdeveloper.org/news/16577</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has a <a href="http://www.lornajane.net/posts/2011/PHP-Returning-Numeric-Values-in-JSON">quick reminder</a> about an issue in the new <a href="http://joind.in/">joind.in</a> API version - everything was being returned as strings, even integers.
</p>
<blockquote>
A few weeks later (my inbox is a black hole and it takes a while to process these things) I fell over a throwaway comment to an undocumented constant JSON_NUMERIC_CHECK, and I added the constant name to my todo list. In the time it took for me to actually get around to googling for this, some wonderful person updated the PHP manual page (this is why I love PHP) to include it as a documented option, and someone else had added a user contributed note about using it.
</blockquote>
<p>
This option, JSON_NUMERIC_CHECK, tells the <a href="http://php.net/json_encode">json_encode</a> function to property consider numbers in its encoding process. It applies globally, so if there's an instance where you don't want something assigned as a number, you might need to go with another, more flexible JSON encoding option. You can find information about this and other possible options json_encode can take on <a href="http://us.php.net/json_encode">its manual page</a>.
</p>
]]></description>
      <pubDate>Tue, 12 Jul 2011 08:41:39 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lukas Smith's Blog: Lets talk about JSON in Symfony2]]></title>
      <guid>http://www.phpdeveloper.org/news/15349</guid>
      <link>http://www.phpdeveloper.org/news/15349</link>
      <description><![CDATA[<p>
<i>Lukas Smith</i> has <a href="http://pooteeweet.org/blog/0/1850#m1850">a new post</a> to his blog looking at some of his experiences with working with JSON in the upcoming version of the Symfony framework (<a href="http://symfony-reloaded.org/">Symfony2</a>), specifically in using the <a href="http://github.com/knplabs/DoctrineUserBundle">DoctrineUserBundle</a> and load views via JSON.
</p>
<blockquote>
Unfortunately right now there are quite a few issues with taking a 3rd party Bundle which wasn't specifically build to be accessible via JSON. So in the end I build a <a href="http://gist.github.com/648702">MultiplexController</a> that can JSON-ify any controller. The name derives from the fact that it also supports calling multiple routes at once and returning all the data from all these routes in one request. But being good OSS citizens here at Liip, we decided to use this opportunity to try and come up with a more sustainable solution. The goal would be to make it essentially possible to have a 3rd party controller return JSON without having to do anything on the controller level.
</blockquote>
<p>
He talks about the "magic" that lets you define the output format you'd like and how it works on the backend with the templating system to use templates based on the requested file. He points out a few issues with the method - a form request problem and that there's no good way to call <a href="http://php.net/json_encode">json_encode</a> from inside a twig template (as well as redirecting after submission).
</p>]]></description>
      <pubDate>Thu, 28 Oct 2010 12:13:43 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Pablo Viquez' Blog: How to use json_encode with ISO-8859-1 data '" Part2]]></title>
      <guid>http://www.phpdeveloper.org/news/12979</guid>
      <link>http://www.phpdeveloper.org/news/12979</link>
      <description><![CDATA[<p>
As he mentioned in <a href="http://www.phpdeveloper.org/news/12906">a previous entry</a> on his blog, <i>Pablo Viquez</i> found a few issues with character encoding and the <a href="http://php.net/json_encode">json_encode</a> function. He revisits this in <a href="http://www.pabloviquez.com/2009/07/json-iso-8859-1-and-utf-8-%E2%80%93-part2/">a second look</a> at getting it to cooperate with ISO-8859-1 data.
</p>
<blockquote>
One solution that I did, in order to preserve the character set was to encode the data before using the json_encode function to use just A-Z, a-z and 0-9 characters, instead of sending text with accents or symbols. One encoding that fits perfectly in this schema, is Base64 Content-Transfer-Encoding. (see base 64 explanation below) This leads me to the solution: Encode the ISO-8859-1 using base64 and decoded in the client using JavaScript.
</blockquote>
<p>
He includes both a code example for his solution and <a href="http://www.pabloviquez.com/demo_files/Encoding-JSON.zip">downloadable code</a> for you to try it out yourself. 
</p>]]></description>
      <pubDate>Mon, 03 Aug 2009 07:57:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Pablo Viquez's Blog: JSON, ISO 8859-1 and UTF-8 - Part]]></title>
      <guid>http://www.phpdeveloper.org/news/12906</guid>
      <link>http://www.phpdeveloper.org/news/12906</link>
      <description><![CDATA[<p>
After spotting some null values in a few of his form fields following an Ajax request, <i>Pablo Viquez</i> decided to track down his issue:
</p>
<blockquote>
While I was looking at some AJAX calls, I started to have a problem, for some reason, when I tried to query a JSON service I did using JQuery, the result was null for some fields. Going a little deeper, I notice that the records from the DB were OK, and the JavaScript was OK to, so what was the problem? The JSON Encode!
</blockquote>
<p>
His issue stemmed from the character encoding of the string being passed into <a href="http://php.net/json_encode">json_encode</a> (in this case, UTF-8) was coming from a PHP script saved in a page encoded as ISO-8859-1. You can <a href="http://www.pabloviquez.com/demo_files/Encoding-JSON.zip">download the files</a> he's come up with to illustrate the point.
</p>]]></description>
      <pubDate>Mon, 20 Jul 2009 12:42:36 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[ProDevTips.com: jQuery JSON with PHP json_encode and json_decode]]></title>
      <guid>http://www.phpdeveloper.org/news/10847</guid>
      <link>http://www.phpdeveloper.org/news/10847</link>
      <description><![CDATA[<p>
On the ProDevTips blog, <i>Henrik</i> <a href="http://www.prodevtips.com/2008/08/15/jquery-json-with-php-json_encode-and-json_decode/">shows an example</a> of the "perfect combination" of PHP's json functionality and a powerful javascript library, <a href="http://www.jquery.com">jQuery</a>.
</p>
<blockquote>
Today I looked for a replacement for my old jspanserializer.js script that I can't even remember where I found anymore. Turns out that I wont have to either, I can forget it. From now on I'll use <a href="http://code.google.com/p/jquery-json/">jQuery JSON</a> instead.
</blockquote>
<p>
A code example <a href="http://www.prodevtips.com/2008/08/15/jquery-json-with-php-json_encode-and-json_decode/">is included</a> to show the simplicity.
</p>]]></description>
      <pubDate>Mon, 18 Aug 2008 10:22:04 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[ProDevTips Blog: Fluent Arrays and Strings in PHP - Adding JSON and more]]></title>
      <guid>http://www.phpdeveloper.org/news/10626</guid>
      <link>http://www.phpdeveloper.org/news/10626</link>
      <description><![CDATA[<p>
<i>Henrik</i> continues his look at fluent arrays and strings in PHP with <a href="http://www.prodevtips.com/2008/07/11/fluent-arrays-and-strings-in-php-adding-json-and-more/">this second part</a> of his series, adding JSON functionality into the mix.
</p>
<blockquote>
Recently I've had the need to extend the interface further, among other things with JSON support. I've used code published by <a href="http://moblur.org/post/2008/02/23/Ajax-Json-et-compression-Gzip">Nicolas Crovatti</a> to do this. 
</blockquote>
<p>
His <a href="http://www.prodevtips.com/2008/07/11/fluent-arrays-and-strings-in-php-adding-json-and-more/">example</a> shows how the script works to plot out some points for a table of stats. He follows this with an in-depth look at the different methods making up that fluent call (apply2Field, fill_ret, sum and plot). These make the array that can then be passed off to PHP, using <a href="http://www.php.net/json_encode">json_encode</a> to make an easy-consumable JSON message out of the results.
</p>]]></description>
      <pubDate>Thu, 17 Jul 2008 09:32:26 -0500</pubDate>
    </item>
  </channel>
</rss>
