json-decode

PHP::How to convert json object into array if json value contains encoded data?

Hi, I am trying to convert json data in to array using php. But unfortunately my json data contains encoded values. For this reason why i am unable to convert this json object in to array in php. I tried it in different ways, But i couldn't get any solutions to solve this. This is the URL data i am getting from client side. controll...

JSON PHP Javascript - Simple Working Example

HI, I am using the following code request.js var request; function runAjax(JSONstring) { // function returns "AJAX" object, depending on web browser // this is not native JS function! request = new XMLHttpRequest(); request.open("GET", "request.php?json="+JSONstring, true); request.onreadystatechange = sendData; ...

Json_encode, json_decode and UTF8

All, I make a JSON request to a web server using PHP and it returns me a JSON response in a variable. The JSON response will have lots of keys and values. The JSON response I get from the server has special characters in it. So, I use the following statement to convert it to UTF8,decode the JSON and use it as an array to display to the ...

Json - removing square brackets and identifying a certain string

I need some way to either - remove the square brackets when either saving via curl or decoding the json text file and or remove both "created" and "modified" strings so that I am left with just the url string please when saving using curl. [{ "created":"10:30pm 5 August 2010", "url":"\/Images\/Temp\/7553-12a40d5af00-12a45a200-...

Targeting a specific string within Json array while decoding

Hi, I need to decode and specifically target the first url only in this array: [{ "longDateTime":"3:00pm Saturday 21 August 2010", "shortDateTime":"3:00pm Sat", "url":"\/Pics\/ob\/7d778-127a9294cec0-12a929779a2b.Img.jpeg" },{ "longDateTime":"2:00pm Saturday 21 August 2010", "shortDateTime":"2:00pm Sat", "url":"\/Pics\/ob\/7d778-12a9275d...

How to add linebreak to decoded json array in php

Hi, I need to add some sort of line break after each segment (date, name, address, phone) to separate them, I have tried using the break and paragraph etc but just keep on getting syntax errors with the usual unexpected "<" and have also tried using tables but that failed too. Is there an easy way to format the output of this to display...

Dealing with hash in PHP json object

I have a json object that follows the following structure: $foo->bar['1']->#foobar The hash is causing it to fail, how do I get the value of #foobar? Thanks ...

Targetting a specific part of json array, if present create table.

Hi All, I have a complex json array which I want to target a specific line/string and if present then add a small table to web page... This is the array { "coastalWarnings":[{ "loc":"ABEL", "warn":"GALE" },{ "loc":"CASTLEPOINT", "warn":"STORM" },{ "loc":"CHALMERS", "warn":"GALE" },{ "loc":"CHATHAM ISLANDS", "warn"...

Convert JSON in print format to valid JSON

Hello, I have a text file that is formatted like JSON, but in a print/view friendly format and I want to convert that string to valid JSON. Basically, I want to read the file using PHP5 and call json_decode to deserialize the string. But, json_decode is not able to parse the "print-friendly" json string. I am getting error 4 Invalid or...

PHP JSON Data Selection

How would I go about selecting the data of each title from the following JSON? I have the JSON decoded, but I'm not sure how to select the part I want. { "responseData": { "results": [ { "title": "Justin Giesbrecht 749", "titleNoFormatting": "Justin Giesbrecht 749", }, ...

Actionscript: unable to assign JSON decoded object as dataProvider

I am trying to use JSON decoded as a dataProvider, but no matter what I try I get errors such as the following: Error #1034: Type Coercion failed: cannot convert mx.collections::ArrayCollection@2a88ae01 to fl.data.DataProvider. I am only returning a simple JSON object array of 3 elements with 3 properties each. I am currently doi...

Android decoding json response

the request processing code while($op=db_fetch_object($result)) { $data[$i++]=array($op->name,$op->age,$op->dept); } echo json_encode($data); $data contains [["Aadidev","23","division1"],["Ragman","35","division3"],["Sahlaad","27","division1"],["Maraadhak","21","division2"],["Arya","48","division1"],["Shank","25","d...

Illegal Token error while decoding JSON on Zend Framework

Guys, Im running this example given on zendcasts and i seem to be getting a "Illegal Token" error. An error occurred Application error Exception information: Message: Illegal Token Stack trace: #0 /Applications/Zend/Zend Studio - 7.2.1/plugins/org.zend.php.framework.resource_7.2.0.v20100324-1300/resources/ZendFramework-1/library/Z...

need a Saple JSON parser in objective c

I want to know to parse a json object in objective c... i get the json object by loading a url.... can u please tell me how to do it or any samples or any reference.... the following is the sample json... {"name":"WFNX","now": {"id":"17749528","song":"Back Down South","artist":"Kings Of Leon"}, "desc":"101.7 - True Alternative",...

Deserializing JSON 2 Dimension array of values

Hi all, I've got a 2 dimensional of values in JSON format: [[57, 2], [57, 2], [58, 2], [55, 2], [60, 2], [54, 1], [59, 11]] Each of the pairs actually contains a pair of unrelated readings, and there is one pair for each minute. So in the first min, reading 1 is 57 and reading 2 is 2 and in the second minute, the readings are the same...

Parse Json in php

Does anyone how to display in php the weather by date? This is what I tried Nothing yet with: <?php $url="http://www.worldweatheronline.com/feed/weather.ashx?q=schruns,austria&amp;format=json&amp;num_of_days=5&amp;key=8f2d1ea151085304102710"; $json = file_get_contents($url); $data = json_decode($json, TRUE); echo $data[0]->weather...

How to use the YAJL for objective c

Hi can any one tell the steps to use the YAJL to parse the json object in objective c Thanks.. ...