invalid json in php jsonlint -


i have script :

<?php  $ch = curl_init();  curl_setopt($ch, curlopt_url,"http://example.com/?weather=usa"); curl_setopt($ch, curlopt_returntransfer, true);  $result = curl_exec ($ch); $row = json_decode($result, true); echo $row['teston']; ?> 

and json :

{     "test": ["test1", "test2", "test3"],     "teston": "teston2",     "debug": {} } {     "test": ["test1", "test2", "test3"],     "teston": "teston2",     "debug": {} } 

i json data in other site,and jsonlint have notice json invalid

error: parse error on line 5: ...n2", "debug": {}} {  "test": ["test1", ---------------------^ expecting 'eof', '}', ',', ']', got '{' 

what must script work?

edit : after add var_dump($result); output :

string(1204) "{     "test": ["test1", "test2", "test3"],     "teston": "teston2",     "debug": {} } {     "test": ["test1", "test2", "test3"],     "teston": "teston2",     "debug": {} }" 

i'm convert json xml code :

<?php $result = $this->rawresponse; $config = array(     'input-xml' => 1, ); $repairitfirst = tidy_repair_string($result, $config); $willbearray = json_encode(simplexml_load_string($repairitfirst)); $jsonfromxml = $willbearray; ?> 

is wrong php convert code? in script contain loops :

<?php foreach($this->params $key=>$val) {   $this->rawrequest .= "&$key=$val"; } ?> 

how $this->params $key=>$val without loops? possible?


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -