开发者

XML::XML2JSON "0" Element

开发者 https://www.devze.com 2022-12-29 07:09 出处:网络
I\'m using XML::XML2JSON in Perl to convert JSON data to XML, I am passing through the following data (snippet):

I'm using XML::XML2JSON in Perl to convert JSON data to XML, I am passing through the following data (snippet):

{"question":{"isrequired":{"$t":"0"}}}

and when I use the XML:XML2JSON->json2xml function to convert the JSON data into XML, I get the following (snippet):

<isrequired/>

I need to retain the "0" element in the开发者_如何学运维 "isrequired" tag, because at times, I will have empty JSON elements, and need the empty XML tag. I think the documentation is a bit vague (either that, or I don't understand it), but is this possible to do with this module?

I would appreciate the help. Thanks.


Try a "zero but true" value instead of "0":

" 0 "
" 0"
"0E0"
0

精彩评论

暂无评论...
验证码 换一张
取 消