I want to convert xml file into my specific JSON format
Example :
<Bank>
<Account>
<Id1>1001</Id1>
<Name1>Sony Corporation</Name1>
<Amt1>1000000</Amt1>
<age>23</age>
</Account>
<Account>
<Id2>1002</Id2>
<Name2>Sony Corporation</Name2>
<Amt2>1000000</Amt2>
</Account>
</Bank>
Now JSON format :
- For JSON format I want to identify which tag has child element and which tag has not? If it has child then I have to start one object into that object column name and start array.
example :
{
"Bank":[
- I want to identify end tag also i.e. in our case Account,Bank end tag? for that I want to close array and object
example:
}
]
- For element which has no childs.
example:
{
"column name":"Id",
"column value":"1001"
}
- For element which has no childs we have maxCount.
Example:
If maxCount is 3 then only first three childs should be written into JSON.
Please give me hints for completing this task... thanks in advance...