I am trying to parse xml with php into a single element json array.
This is what I have:
$t = array();
$a=array("url"=>$test->channel->item->link);
array_push($t,$a);
echo json_encode($t);;
Which gives me this:
[{"url":{"0":"http:www.example.com"}}]
But I am looking for this:
[{"url":"http:www.example.com"}]
It seems that $test->channel->item->link
parses with curly brackets as {url}
but if I do echo $test->channel->item->link
, I get: www.example.com
without the curly brackets.
Not sure if this is what you're looking for, but it works :)