Parsing JSON to XML using net.sf.json (java)

Posted by Castanho on Stack Overflow See other posts from Stack Overflow or by Castanho
Published on 2010-04-15T23:07:24Z Indexed on 2010/04/15 23:13 UTC
Read the original article Hit count: 283

Filed under:
|
|
|
|

Hi guys,

I'm parsing a generic JSON to a XML using net.sf.json. (I'm not using POJO Obj in the conversion)

When dealing with vectors I'm receiving:

<root>
    <entry>
        <Id>1</accountId>
        <Items>
            <e>
                <cost>0.1</cost>
                <debit>0.1</debit>
            </e>
            <e>
                <cost>0.1</cost>
                <debit>0.1</debit>
            </e>
        </Items>
    </entry>
</root>

When the correct for my point of view should be:

<root>
    <entry>
        <accountId>1</accountId>
        <Items>
                <cost>0.1</cost>
                <debit>0.1</debit>
        </Items>
        <Items>
                <cost>0.2</cost>
                <debit>0.2</debit>
        </Items>
    </entry>
</root>

Do anyone have used this lib and could help me?

Any tips could help!

Thanks in advance

© Stack Overflow or respective owner

Related posts about java

Related posts about JSON