knipknap/Gelatin

XML vs Json

Opened this issue · 0 comments

Any idea why this XML:

<xml>
  <vip LocalAddress="10.140.67.150" LocalPort="10002">
    <entries>
      <remoteaddress>10.57.0.168</remoteaddress>
      <remoteport>18676</remoteport>
    </entries>
  </vip>
  <vip LocalAddress="10.140.67.150" LocalPort="10183">
    <entries>
      <remoteaddress>10.57.0.168</remoteaddress>
      <remoteport>6900</remoteport>
    </entries>
    <entries>
      <remoteaddress>10.57.0.176</remoteaddress>
      <remoteport>5293</remoteport>
    </entries>
  </vip>
</xml>

translates to this Json:

{
    "vip": [
        {
            "@LocalAddress": "10.140.67.150",
            "@LocalPort": "10002",
            "entries": {
                "remoteaddress": {
                    "#text": "10.57.0.168"
                },
                "remoteport": {
                    "#text": "18676"
                }
            }
        },
        {
            "@LocalAddress": "10.140.67.150",
            "@LocalPort": "10183",
            "entries": [
                {
                    "remoteaddress": {
                        "#text": "10.57.0.168"
                    },
                    "remoteport": {
                        "#text": "6900"
                    }
                },
                {
                    "remoteaddress": {
                        "#text": "10.57.0.176"
                    },
                    "remoteport": {
                        "#text": "5293"
                    }
                }
            ]
        }
    ]
}

that is pretty ugly (why @, #text ???)
?

Thanks in advance