skip to Main Content

I am using XmlMapper in Java to create XML from JSON

The required XML structure is:

<Months>
 <Month>May</Month>
 <Month>August</Month>
 <Month>November</Month>
 <Month>February</Month>
</Months>

How should my JSON look like to have the above format of XML?

I tried my JSON as below, but that did not return a valid output

"Months": ["May",
           "August",
           "November",
           "February"]

3

Answers


  1. Possibly

    "Months": [ 
       { "Month": "May" }, 
       { "Month": "August" }, 
       { "Month": "November" }, 
       { "Month": "February" },
    ]
    
    Login or Signup to reply.
  2. {
    "Months" : ["May", "August", "November", "February"]
    }
    
    Login or Signup to reply.
  3. {
      "Months": [
        {"Month": "May"},
        {"Month": "August"},
        {"Month": "November"},
        {"Month": "February"}
      ]
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search