title: Is use of @attributes in JSON non-standard or standard?
body: <p>We're adding JSON output to an existing API that outputs XML, to make MobileHTML integration much easier. However, our developer has queried the use of @attributes appearing in the JSON output.</p>
  
  <p>Our original XML looks like:</p>
  
  <pre><code>&lt;markers&gt;
      &lt;marker id="11906" latitude="52.226578"
      ...
  </code></pre>
  
  <p>and so the JSON comes out as:</p>
  
  <pre><code>callbackname({"marker":[{"@attributes":{"id":"11906","latitude":"52.226578"
  ....
  </code></pre>
  
  <p>Our developer has stated:</p>
  
  <blockquote>
    <p>"Although '@attributes' is legal JSON, it seems to break dot notation, so I can't call data.@attributes. I can call data['@attributes'], so there's a workaround, but it seems safer just to avoid the @-symbol, unless there's a good reason for it."</p>
  </blockquote>
  
  <p>The XML->JSON(P) conversion is done using:</p>
  
  <pre><code>$xmlObject = simplexml_load_string ($data);
  $data = json_encode ($xmlObject);
  </code></pre>
  
  <p>I want to make our API as easy-to-integrate as possible, and therefore to use standard stuff where possible. But we're using the native PHP json_encode function, so I'd be surprised if it's doing something non-standard.</p>
  
  <p>Is use of @attributes non-standard? Is this basically just the problem that our API is a bit broken in terms of using <code>&lt;marker id..&gt;</code> rather than <code>&lt;marker&gt;&lt;id&gt;</code> ?</p>