使用SimpleXML解析XML Feed后的错误JSON格式

I'm parsing an XML feed, and attempting to create JSON output. I can't seem to figure out why my JSON formatting is off. This is the code I'm using to loop through the XML feed, parse it, and build JSON output:

$xml = simplexml_load_file($myxmlfeed, 'SimpleXMLElement', LIBXML_NOERROR | LIBXML_NOWARNING);

foreach ($xml->{'xml-node-name'} as $article)
{
  $tmp = array(
            "title" => $article->title,
            "image" => null,
            "resource" => array(
                    "articleLink" => $site)
            );
  array_push($array, $tmp);
  unset($tmp);
}

This is the output:

[
 {
   "title":{
     "0":"This is my article title"
   },
   "image":null,
   "resource":{
     "articleLink":"http://www.website.com/link.html"
   }
 }
]

However, this is the output format I need:

[
 {
   "title":"This is my article title",
   "image":null,
   "resource":{
     "articleLink":"http://www.website.com/link.html"
   }
 }
]

Why is the "title" being added as a key/value pair?

It would appear that $article->title is an array, not a string as you desire. A sample of the XML would help us explain why, but in the mean time you need to be accessing element 0 of that array:

$tmp = array(
    "title" => $article->title[0],
    "image" => null,
    "resource" => array(
        "articleLink" => $site
    )
);