I want to convert the XML file to the JSON format, but I don’t know how to convert it into JSON format. Can anyone help me? Thank you.
<class>
<num>2</num>
<student>
<name>example1@email.com</name>
<age>5</age>
</student>
<student>
<name>example2@email.com</name>
<age>10</age>
</student>
</class>
Update:
sorry to everyone
I don’t mention it clearly
I just want to JSON format of the above XML file.
And it is not done by any program.
The answer will like the
{
"class"
...
}
I am writing this answer assuming you are interested in JSON representation itself of given XML and not in how you convert it.
Exact representation:
But I think you should define a member as array of Student. Which will result in: