json-decode

Anyone have issues going from ColdFusion's serializeJSON method to PHP's json_decode?

The Interwebs are no help on this one. We're encoding data in ColdFusion using serializeJSON and trying to decode it in PHP using json_decode. Most of the time, this is working fine, but in some cases, json_decode returns NULL. We've looked for the obvious culprits, but serializeJSON seems to be formatting things as expected. What else c...

What puts less load on a PHP server: SimpleXML or json_decode?

I'm starting to develop a web application in PHP that I hope will become incredibly popular and make me famous and rich. :-) If that time comes, my decision whether to parse the API's data as XML with SimpleXML or to use json_decode could make a difference in the app's scalability. Does anyone know which of these approaches is more eff...

PHP-Json Problem

Hi there.. I have to similar Json files... I can json_decode read one of them... but I can't other one... I've uploaded files to http://www.huzursuz.com/json/json_test.rar if would you like to see, "brother_a.php" is working, "brother.php" is not... I don't think this is json_decode nested limit, because files are so similar... Tha...

json_decode returns NULL (php)

There is a strange behaviour with json_encode and json_decode and I can't find a solution: My php application calls a php web service. The webservice returns json that looks like this: var_dump($foo): string(62) "{"action":"set","user":"123123123123","status":"OK"}" now I like to decode the json in my application: $data = json_dec...

Python JSON decoding performance.

I'm using the json module in Python 2.6 to load and decode JSON files. However I'm currently getting slower than expected performance. I'm using a test case which is 6MB in size and json.loads() is taking 20 seconds. I thought the json module had some native code to speed up the decoding? How do I check if this is being used? As a com...

Set the maximum recursion depth while serializing a Django model with Foriegn key to JSON

Hi, I have a Django model created for Google's App Engine, Model A(): propA = ReferenceProperty(B) Model B(): propB = ReferenceProperty(C) Model C(): propC = ReferenceProperty(B) I have written custom Django serializer which will fetch the data for the ReferenceProperty(s) and serialize that along the initial model. The prob...

How to decode HTML encoded character embedded in a json string

Hi I've a little question about decoding special characters from a JSon result (in my case, \x27 but it could be any valid html encoded character). If the result doesn't contains any escaped characters, it works well but if not, I get a Unrecognized escape sequence exception. I try to do an HttpUtility.HtmlDecode on the Json string bef...

ASP.NET JSON Web Service Response format

I have written one simple web service which get product list in JSONText which is string object Web Service code is below using System; using System.Collections.Generic; using System.Web; using System.Web.Services; using System.Web.Script.Services; using System.Runtime.Serialization.Json; using System.IO; using System.Text; /// <sum...

json decode in php

I have the following json string and I want to retrieve just the email address from it. How do I do it in php? {"communications":{"communication":[{"@array":"true","@id":"23101384","@uri":"xyz/v1/Communications/1111","household":{"@id":"111111","@uri":"xyz/v1/Households/5465465"},"person":{"@id":"","@uri":""},"communicationType":{"@id"...

PHP json_decode notation issue

I am having an issue dealing with the notation used in a JSON file I am trying parse. Some of the nodes have . (periods) in the names which escapes object-notation ($json = $article->rssFeed.url;) How would I go about selecting the nodes. Do I need to str_replace the .(periods), or is there some other notation I can use? Here is a sni...

LINQ and JSON.NET when the property names vary

I am attempting to parse some JSON content in to C#. For the simpler cases I am having great success with JSON.NET and really appreciate the clean approach offered by the LINQ provider. Here's an example where I'm downloading information about a layer in a map and filling in some properties on a class called (suprisingly!) Layer: ...

How to decode and cast JSON string in Flex?

I'm using as3corelib to decode/encode JSON strings. In my little experiment I want to encode an object (UserInfo) to JSON string and decode it back to the object, however it seems to fail at the convertion point (the last line), why would that happen? how can I make it work? The UserInfo class public class UserInfo { public var le...

c# How to retrieve Json data into an array

Hi! I have found different libraries that can parse Json data, but i did not find any documentation on how to get the data into an C# array or list. I got this Json data: {"001":{"Name":"John", "Phone":["Mob - 98837374","Mob - 98363627"]}, "002":{"Name":"Tom", "Phone":["Mob - 49858857"]}} Anybody got a clue? :) Edit: Useful detail...

access json object and array

Here is my JSON data : {"Liste_des_produits1":[{"Added_Time":"28-Sep-2009 16:35:03","prod_ingredient":"sgsdgds","prod_danger":["sans danger pour xyz"],"prod_odeur":["Orange"],"prod_nom":"ceciestunproduit","prod_certification":["HE • Haute Efficité","Certifier Ecologo","Contenant recyclable"],"prod_photo":"","prod_categorie":["...

Help with JSON format

I'm using a JSON example off the web, as seen below. { "menu": "File", "commands": [ { "title": "New", "action":"CreateDoc" }, { "title": "Open", "action": "OpenDoc" }, { "title": "Close", "action": "CloseDoc" } ] } I've tried...

How to do Ruby object serialization using JSON

I have a structure of simple container classes like so (in pseudo ruby): class A attr_reader :string_field1, :string_field2 ... end class B attr_reader: int_field3, :string_field4 ... end # C includes an instance of A and B class C attr_reader: :a_instance, :b_instance ... end Is there are simple way to de/serialize this...

php - combining json with json_decode

Hi, I'm trying to combine multiple JSON objects into a single one in PHP. I'm iterating through the JSON objets, decoding them, parsing out the parts I want to keep, and storing them in a property in my php class. Supposing my json objects look like the following format: { "lists" : { "list" : [ { ...

PHP json_decode question

hi, i'm trying to use json_decode to combine a few json objects and then re-encode it. my json looks like: { "core": { "segment": [ { "id": 7, "name": "test1" }, { "id": 4, "name": "test2" } ] } } ...

How to access a member of a class which is inside another object from JSON using PHP

I have a JSON String like this $test='{"var1":null,"var3":null,"status":{"code":150,"message":"blah blah"}}'; I want to access the status code in the function. this is what i tried: $responseObj=jsonService->decode($test);//this converts the string into an Object echo $responseObj->status->code; now this isnt working. Can someone ...

Error at json: "missing ] after element list" or just "undefined"

Hello! I have a json like: {"156644":{ "name":"name1", "street":"street1", "city":"city1" "68656":{ "name":"name2 ", "street":"street2", "city":"city1" "388655":{ "name":"name3", "street":"street3", "city":"city1" "4564":{ "name":"name4", "street":"street...