What im wondering out of the reply is I cant have a nested JSON object with the following layout?
groupID, groupName, groupItems(array of items) similar example: http://labs.adobe.com/technologies/spry/samples/data_region/JSONDataSetSample.html#Example5 Regards, Jason On Wed, Dec 17, 2008 at 7:02 PM, Ryan Gahl <[email protected]> wrote: > typo... "...with NO properties" > > > > On Wed, Dec 17, 2008 at 10:02 AM, Ryan Gahl <[email protected]> wrote: > >> Here are your problems... I'll remove the bulk of the data to make it more >> clear: >> >> rsJson: {[{...}]} >> >> what you have is illegal. You're essentially saying you have an anonymous >> object with not properties and filling it with an array (that's probably not >> even totally accurate)... the bottom line is, you can't have a curly brace >> immediately followed by a square brace. And going further you have it all >> just sitting in a property floating in space. The first thing you need to do >> is wrap the property in curlies so you're actually returning an object... >> >> {rsJson: ...} >> >> Now, this other issue of putting a square bracket right inside a curly... >> You can either a) remove the outer curlies and just make rsJson be an array, >> or b) add a property name which then becomes the array. >> >> a) >> {rsJson: [{}, {}, ...]} >> >> b) >> {rsJson: {myArray: [...]}} >> >> >> >> >> On Wed, Dec 17, 2008 at 9:53 AM, jason maina <[email protected]>wrote: >> >>> Hi all, >>> Below is JSON encoded(php) data. After evaluating and sanitizing it im >>> not capable of extracting its contents im just not sure what im doing wrong: >>> >>> [php output] >>> >>> >>> rsJson:{[{"groupCode":"1","groupName":"Roses","flowers":[{"flowerCode":"15","flowerName":"Roses"}]}, >>> {"groupCode":"2","groupName":"Carnations","flowers":[{"flowerCode":"16","flowerName":"Spray >>> Carnations" >>> },{"flowerCode":"17","flowerName":"Standard >>> Carnations"}]},{"groupCode":"3","groupName":"Perennials" >>> >>> ,"flowers":[{"flowerCode":"2","flowerName":"Aster"},{"flowerCode":"3","flowerName":"Alstromeria"},{"flowerCode" >>> :"10","flowerName":"Gysophila"},{"flowerCode":"12","flowerName":"Limonium >>> Perezzi"}]},{"groupCode":"4" >>> ,"groupName":"Annuals","flowers":[{"flowerCode":"1","flowerName":"Ammi >>> Majus"},{"flowerCode":"4","flowerName" >>> :"Bupleurum"},{"flowerCode":"5","flowerName":"Carthamus"},{"flowerCode":"6","flowerName":"Chinese >>> Aster" >>> >>> },{"flowerCode":"7","flowerName":"Chrysantemum"},{"flowerCode":"8","flowerName":"Delphinium"},{"flowerCode" >>> >>> :"13","flowerName":"Lisianthus"},{"flowerCode":"14","flowerName":"Molucella"},{"flowerCode":"18","flowerName" >>> >>> :"Statice"},{"flowerCode":"19","flowerName":"Stocks"}]},{"groupCode":"5","groupName":"Bulbs","flowers" >>> >>> :[{"flowerCode":"9","flowerName":"Freesia"},{"flowerCode":"11","flowerName":"Lilies"}]}]} >>> >>> [php output] >>> >>> var jsonObj = res.responseText.evalJSON(true); >>> alert(jsonObj); >>> >>> will not even popup, on firebug no errors showing up. >>> >>> Kind regards >>> Jason >>> >>> >>> >>> >> >> >> -- >> Ryan Gahl >> CEO >> Nth Penguin, LLC >> http://www.nthpenguin.com >> -- >> WebWidgetry.com / MashupStudio.com >> Future Home of the World's First Complete Web Platform >> -- >> Inquire: 1-920-574-2218 >> Blog: http://www.someElement.com >> LinkedIn Profile: http://www.linkedin.com/in/ryangahl >> > > > > -- > Ryan Gahl > CEO > Nth Penguin, LLC > http://www.nthpenguin.com > -- > WebWidgetry.com / MashupStudio.com > Future Home of the World's First Complete Web Platform > -- > Inquire: 1-920-574-2218 > Blog: http://www.someElement.com > LinkedIn Profile: http://www.linkedin.com/in/ryangahl > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
