Skip to content

Conversation

@minhaajk
Copy link

Fix for #17 : Incorrect data encoded in json when numeric support is enabled

@tgn3000
Copy link

tgn3000 commented Sep 23, 2020

I cannot reproduce this somehow. master branch produces correct results for me.

@minhaajk
Copy link
Author

minhaajk commented Jun 2, 2021

I cannot reproduce this somehow. master branch produces correct results for me.

Hello @tgn3000 , the issue is when we enable numeric support and try to convert the xml.

Kindly change it in xml2json.hpp (line 32) and try again

static const bool xml2json_numeric_support = true;

Now try with the following input :

Input XML

<?xml version="1.0"?>
<Book>
	<name>Sample Book Name</name>
	<author>New Author</author>
	<ISBN>99921-58-10-7</ISBN>
	<price>102.50</price>
</Book>

Output JSON

{
    "Book": {
        "name": "Sample Book Name",
        "author": "New Author",
        "ISBN": 99921,
        "price": 102.5
    }
}

Value like 99921-58-10-7 is encoded as 99921 in json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants