Re: Thinking out loud - a continuation...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26 Mar 2012, at 19:12, Jay Blanchard wrote:

> [snip]
> This is one of "those" projects. It is apparently going to be trying every step of the way.
> [/snip]
> 
> I was proven right this morning after all of Robert's good work and what I had added to make this work.  It turns out that the one service who was anxious to consume the JSON output expects that the JSON be a certain format. When I run their format through jslint it does not validate unless I add quotes around the name portion of the name:value pairs. In addition they use (perfectly valid) square brackets around the children groups that the output from json_encode() does not contain.
> 
> I am ready to take a loss on this one but I really didn't lose - Robert gave me a great way to retrieve the data with one query and create valid JSON from it. Thanks again Robert!

Square brackets in JSON represent arrays. Take their JSON, run it through json_decode, and assuming it decodes correctly compare the structure to what you already have. You should then be able to modify what you have so it generates JSON in the format they are expecting.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux