title: Converting xml to json using jackson
body: <p>I want to convert an xml to json.</p>
  
  <p>The format of of xml is as follows -  </p>
  
  <pre><code> &lt;default&gt; 
        &lt;column&gt;                      
          &lt;title&gt;Title 1&lt;/title&gt;
      &lt;id&gt;id1&lt;/id&gt;
      &lt;value&gt;val1&lt;/value&gt;
    &lt;/column&gt;
    &lt;column&gt;
      &lt;title&gt;Title 2&lt;/title&gt;
      &lt;id&gt;id2&lt;/id&gt;
      &lt;value&gt;val2&lt;/value&gt;
    &lt;/column&gt;
    &lt;column&gt;
      &lt;title&gt;Title 3&lt;/title&gt;
      &lt;id&gt;id3&lt;/id&gt;
      &lt;value&gt;val3&lt;/value&gt;
    &lt;/column&gt;
    &lt;/default&gt;
  </code></pre>
  
  <p>And after the conversion i am expecting following json -</p>
  
  <pre><code>{
      "column": [
          {
              "title": "Title 1",
              "id": "id1",
              "value": "val1"
          },
          {
              "title": "Title 2",
              "id": "id2",
              "value": "val2"
          },
          {
              "title": "Title 3",
              "id": "id3",
              "value": "val3"
          }
      ]
  }
  </code></pre>
  
  <p>But when i use jackson for this purpose it gives me following json -  </p>
  
  <pre><code>{
      "column": {
          "title": "Title 3",
          "id": "id3",
          "value": "val3"
      }
  }
  </code></pre>
  
  <p>I have tried using jackson 1.9 and jackson 2.1, but it didnt gave me the expected output.</p>
  
  <p>Can some one please let me know that whether it is possible or i need to change my xml format ?
  Following is the code that i have written to acheive the above scenario -</p>
  
  <pre><code>    try {
              XmlMapper xmlMapper = new XmlMapper();
              Map entries = xmlMapper.readValue(new File("xmlPath"), Map.class);
  
              ObjectMapper jsonMapper = new ObjectMapper();
              String json = jsonMapper.writeValueAsString(entries);
              System.out.println(json);
  
          } catch (Exception e) {
              e.printStackTrace();
          }       
  </code></pre>
  
  <p>Thanks</p>