title: Convert XML to JSON without attributes using PHP?
body: <p>I want to convert and <strong>XML</strong> file to <strong>JSON</strong> with PHP. The XML file looks like this:</p>
  
  <pre><code>&lt;content&gt;
      &lt;!-- other elements... --&gt;
      &lt;box id="1"&gt;
          &lt;a&gt;...&lt;/a&gt;
          &lt;b&gt;...&lt;/b&gt;
          &lt;c&gt;...&lt;/c&gt;
      &lt;/box&gt;
      &lt;box id="2"&gt;
          &lt;a&gt;...&lt;/a&gt;
          &lt;b&gt;...&lt;/b&gt;
          &lt;c&gt;...&lt;/c&gt;
      &lt;/box&gt;
      &lt;box id="3"&gt;
          &lt;a&gt;...&lt;/a&gt;
          &lt;b&gt;...&lt;/b&gt;
          &lt;c&gt;...&lt;/c&gt;
      &lt;/box&gt;
      &lt;!-- more &lt;box&gt; elements... --&gt;
      &lt;!-- other elements... --&gt;
  &lt;/content&gt;
  </code></pre>
  
  <p>I am using this simple PHP script:</p>
  
  <pre><code>// Open XML file with SimpleXML.
  $xml = simplexml_load_file('file.xml');
  // Convert XML content to JSON.
  $json = json_encode($xml);
  // Output JSON.
  echo $json;
  </code></pre>
  
  <p>I get the full content of the XML file as JSON output, however I need to modify the script to:</p>
  
  <ul>
  <li>Get only JSON for the <code>&lt;box&gt;</code>
  elements, not the complete file.</li>
  <li>Get JSON without element attributes.</li>
  </ul>
  
  <p>This is an example of what I want to get as output:</p>
  
  <pre><code>[{"a":"...","b":"...","c":"..."},
  {"a":"...","b":"...","c":"..."},
  {"a":"...","b":"...","c":"..."}]
  </code></pre>
  
  <p>Please help me, how can I do this? what is the best practice?</p>
  
  <p>Thanks in advance.</p>