Skip to content

Information is lost when converting hexadecimal value from xml to json. #852

@anki006

Description

@anki006

While parsing an XML which has hexadecimal value which starts with number (0-9), for example below:
<color> <color_type>primary</color_type> <value>008E97</value> </color>

The equivalent json is formed is:
"color": [ { "color_type": "primary", "value": 8e+97 } ]

However, if the hexadecimal value starts with string, its equivalent json is also a string.
<color> <color_type>primary</color_type> <value>fc4c02</value> </color>
The equivalent json is formed is:
"color": [ { "color_type": "primary", "value": "fc4c02" } ]

The code fails to handle hexadecimal conversion and creates ambiguity by treating it as number and string both. I assume, if there is ambiguities like this, we need to stick to string rather than converting to number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions