0

net.sf.json を使用して、一般的な JSON を XML に解析しています。(私は変換で POJO Obj を使用していません)

私が変換しているJson:

{
    "root": {
        "accountId": "1000",
        "Items": [
            {
                "cost": 0.1,
                "debit": 0.1
            },
            {
                "cost": 0.2,
                "debit": 0.2
            } 
        ] 
    }
}

私が受け取っているベクトルを扱うとき:

<root>
    <entry>
        <accountId>1000</accountId>
        <Items>
            <e>
                <cost>0.1</cost>
                <debit>0.1</debit>
            </e>
            <e>
                <cost>0.2</cost>
                <debit>0.2</debit>
            </e>
        </Items>
    </entry>
</root>

私の視点で正しいのは次のとおりです。

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

誰かがこのライブラリを使用していて、私を助けることができますか?

どんなヒントでも役に立ちます!

前もって感謝します

4

1 に答える 1

0

JSON をこの形式に変更します。

{ "root": { "accountId": "1000", "Items":{"Item":{"cost": 0.1,"debit": 0.1,"cost": 0.2,"debit": 0.2} } } }

于 2010-04-19T14:46:50.910 に答える