title: xml to json, is there a way to use an attribute's value as a key for easier lookup?
body: <p>I have an XML file containing multiple items and I tried a couple of xml to json libray and settled on csv-parser.
  right now if I want to check if the object meet the requirement I want before transforming it, I need to loop through the items, and then loop through the property tag to see if I can find the property DisplayType and then check it's value.</p>
  
  <p>Is there a way to tell csv-parser to use the "name" attribute as an ID for the object?</p>
  
  <p>Sometimes I have 5 for-loops in each other and it's getting confusing.</p>
  
  <p>EDIT:
  The main goal is to filter the items where the value for <strong>property[@name='DisplayType']</strong> is <strong>Weapon</strong>, loop through those and do some stuff. Then rince and repeat for other properties and attributes.</p>
  
  <p>I need to filter, arrange and add data before inserting in a database.</p>
  
  <p>"Raw":</p>
  
  <pre><code>&lt;items&gt;
      &lt;item name="Knife"&gt;
          &lt;property name="HoldType" value="31"/&gt;
          &lt;property name="DisplayType" value="Weapon"/&gt;
          &lt;property name="Meshfile" value="Items/Misc/parcelPrefab"/&gt;
          &lt;property name="Material" value="MresourceCrop"/&gt;
          &lt;property name="Stack" value="10"/&gt; 
          &lt;property name="Value" value="3"/&gt;
          &lt;events&gt;
                  &lt;event name="Testing Events" type="Something"/&gt;
                  &lt;event name="Testing Events2" type="Something"/&gt;
          &lt;/events&gt;
      &lt;/item&gt;
      &lt;item name="Knife"&gt;
          &lt;property name="HoldType" value="31"/&gt;
          &lt;property name="DisplayType" value="Weapon"/&gt;
          &lt;property name="Meshfile" value="Items/Misc/parcelPrefab"/&gt;
          &lt;property name="Material" value="MresourceCrop"/&gt;
          &lt;property name="Stack" value="10"/&gt; 
          &lt;property name="Value" value="3"/&gt;
      &lt;/item&gt;
  &lt;/items&gt;
  </code></pre>
  
  <p>Json (example):</p>
  
  <pre><code>{
      "items": {
          "item": [
              {
                  "name": "Knife",
                  "property": [
                      {
                          "name": "HoldType",
                          "value": "31"
                      },
                      {
                          "name": "DisplayType",
                          "value": "Weapon"
                      },
                      {
                          "name": "Meshfile",
                          "value": "Items/Misc/parcelPrefab"
                      },
                      {
                          "name": "Material",
                          "value": "MresourceCrop"
                      },
  </code></pre>
  
  <p>What I wish I could get:</p>
  
  <pre><code>{
      "items": {
              "Knife": {
                  "name": "Knife",
                  "property": [
                      "HoldType": {
                          "name": "HoldType",
                          "value": "31"
                      },
                      "DisplayType": {
                          "name": "DisplayType",
                          "value": "Weapon"
                      },
                      "Meshfile": {
                          "name": "Meshfile",
                          "value": "Items/Misc/parcelPrefab"
                      },
                      "Material": {
                          "name": "Material",
                          "value": "MresourceCrop"
                      },
  </code></pre>