title: Losing data field when converting XML string to JSON with xml-js or xml2js
body: <p>I am trying to convert an xml string to json. All the data until now has been loading successfully, but then I discovered that sometimes when reading the data, the point did not exist.</p>
  <p>Using this xmlString:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;!DOCTYPE Metadata SYSTEM &quot;/data/someConfig/path&quot;&gt;&lt;Metadata&gt;
      &lt;Standard&gt;
          &lt;Priority&gt;Medium&lt;/Priority&gt;
          &lt;DueDate/&gt;
          &lt;Comment/&gt;
          &lt;Size/&gt;
      &lt;/Standard&gt;
      &lt;PublicationsInformation/&gt;
      &lt;Details&gt;
          &lt;CommissionedCount/&gt;
      &lt;/Details&gt;
      &lt;EventDetails&gt;
          &lt;EventContacts&gt;
              &lt;EventContact&gt;
                  &lt;PersonName/&gt;
                  &lt;PersonEmail/&gt;
                  &lt;PersonPhone/&gt;
              &lt;/EventContact&gt;
          &lt;/EventContacts&gt;
          &lt;Journalist&gt;
              &lt;PersonName&gt;Journalist name here&lt;/PersonName&gt;
          &lt;/Journalist&gt;
      &lt;/EventDetails&gt;
      &lt;Location&gt;
          &lt;SubLocation&gt;Sydney NSW, Australia&lt;/SubLocation&gt;
          &lt;Suburb&gt;Sydney&lt;/Suburb&gt;
          &lt;State&gt;NSW&lt;/State&gt;
          &lt;Country&gt;AU&lt;/Country&gt;
          &lt;Latitude/&gt;
          &lt;Longitude/&gt;
          &lt;AdditionalLocationDetails/&gt;
          &lt;Lat&gt;-33.8688197&lt;/Lat&gt;
          &lt;Lng&gt;151.2092955&lt;/Lng&gt;
      &lt;/Location&gt;
      &lt;EventAssignedTo&gt;
          &lt;InternalUserEmails/&gt;
          &lt;InternalUserSMS/&gt;
          &lt;InternalUserNames/&gt;
      &lt;/EventAssignedTo&gt;
      &lt;TestPath&gt;
          &lt;EventName&gt;An event name&lt;/EventName&gt;
      &lt;/TestPath&gt;
  &lt;/Metadata&gt;
  </code></pre>
  <p>Run in this code:</p>
  <pre class="lang-js prettyprint-override"><code>export const getCurrentMetaData = (ctx: any): object =&gt; {
      const xmlStr = serializer.serializeToString(xmlMetaData);
  
  
      console.log('XML string: ') 
      console.log(xmlStr)
  
  
      const options = { compact: true, spaces: 4 };
      const json = xml2js(xmlStr, options);
  
      
      console.log('Converted to json: ')
      console.log(json)
      
      return json;
  };
  </code></pre>
  <p>I get this output object:</p>
  <pre class="lang-json prettyprint-override"><code>{
  {
      &quot;_doctype&quot;: &quot;Metadata SYSTEM \&quot;/data/someConfig/path&quot;&quot;,
      &quot;Metadata&quot;: {
          &quot;Standard&quot;: {
              &quot;Priority&quot;: {
                  &quot;_text&quot;: &quot;Medium&quot;
              },
              &quot;DueDate&quot;: {},
              &quot;Comment&quot;: {},
              &quot;Size&quot;: {}
          },
          &quot;PublicationsInformation&quot;: {},
          &quot;Details&quot;: {
              &quot;CommissionedCount&quot;: {}
          },
          &quot;EventDetails&quot;: {
              &quot;EventContacts&quot;: {
                  &quot;EventContact&quot;: [
                      {
                          &quot;PersonName&quot;: &quot;&quot;,
                          &quot;PersonEmail&quot;: &quot;&quot;,
                          &quot;PersonPhone&quot;: &quot;&quot;
                      }
                  ]
              }
          },
          &quot;Location&quot;: {
              &quot;SubLocation&quot;: {
                  &quot;_text&quot;: &quot;Sydney NSW, Australia&quot;
              },
              &quot;Suburb&quot;: {
                  &quot;_text&quot;: &quot;Sydney&quot;
              },
              &quot;State&quot;: {
                  &quot;_text&quot;: &quot;NSW&quot;
              },
              &quot;Country&quot;: {
                  &quot;_text&quot;: &quot;AU&quot;
              },
              &quot;Latitude&quot;: {},
              &quot;Longitude&quot;: {},
              &quot;AdditionalLocationDetails&quot;: {},
              &quot;Lat&quot;: {
                  &quot;_text&quot;: &quot;-33.8688197&quot;
              },
              &quot;Lng&quot;: {
                  &quot;_text&quot;: &quot;151.2092955&quot;
              }
          },
          &quot;EventAssignedTo&quot;: {
              &quot;InternalUserEmails&quot;: {},
              &quot;InternalUserSMS&quot;: {},
              &quot;InternalUserNames&quot;: {}
          },
          &quot;TestPath&quot;: {
              &quot;EventName&quot;: {
                  &quot;_text&quot;: &quot;An event name&quot;
              }
          }
      }
  }
  </code></pre>
  <p>As you can see, the Journalist.PersonName is missing here.
  Furthermore, if I use lodash.get(obj, 'Metadata.EventDetails.Journalist.PersonName._text') I get the information, even if I don't see the data on the actual object when printing it. What is happening here, and do anyone have any idea how to fix it?</p>