String xml = "001230003562023234";
JSONObject object = XML.toJSONObject(xml);
在转成jsonobject 的之后,数据前面的0都不见。
求怎么解决
cn.hutool
hutool-all
4.0.9
import cn.hutool.json.JSONObject;
import cn.hutool.json.XML;
换了工具包就解决了
可以考虑给 XML 内容中节点加上 type="string" 类型试试:
https://docs.microsoft.com/zh-cn/dotnet/framework/wcf/feature-details/mapping-between-json-and-xml
<root type="object">
<myLocalName1 type="string">myValue1</myLocalName1>
<myLocalName2 type="number">2</myLocalName2>
<myLocalName3 type="object">
<myNestedName1 type="boolean">true</myNestedName1>
<myNestedName2 type="null"/>
</myLocalName3>
</root >