Comments (15)
Yes, thank you. Looks like it is working as expected.
from json2xml.
@jbourquin Thanks for reporting this. I will look into fixing it. This seems to be a bug in dicttoxml
package, but I will fix it.
from json2xml.
@jbourquin I just released the fix for it in the pypi. https://pypi.org/project/json2xml/3.17.0/
Thank you so much for reporting the bug in such detailed manner. 🍺
from json2xml.
No problem, I'm also running into a problem with arrays that contain numbers (like booleans).
So if I convert a JSON object that looks like this:
{
"boolean_list": [true, false],
"number_array": [1, 2, 3],
"string_array": ["a", "b", "c"]
}
It returns the following XML:
<all>
<item type="bool">True</item>
<item type="bool">False</item>
<item type="int">1</item>
<item type="int">2</item>
<item type="int">3</item>
<string_array type="list">
<item type="str">a</item>
<item type="str">b</item>
<item type="str">c</item>
</string_array>
</all>
Notice the parent elements are missing for the boolean and number arrays.
from json2xml.
Yeah, I can reproduce it too. Would you like to send a PR to fix this?
from json2xml.
@jbourquin please let me know if you will sending a fix for it, else I will find sometime this week and fix it.
from json2xml.
I'll take a look, but I probably won't be able to get to it before you do.
from json2xml.
No problem, I'm also running into a problem with arrays that contain numbers (like booleans).
So if I convert a JSON object that looks like this:
{ "boolean_list": [true, false], "number_array": [1, 2, 3], "string_array": ["a", "b", "c"] }It returns the following XML:
<all> <item type="bool">True</item> <item type="bool">False</item> <item type="int">1</item> <item type="int">2</item> <item type="int">3</item> <string_array type="list"> <item type="str">a</item> <item type="str">b</item> <item type="str">c</item> </string_array> </all>
Notice the parent elements are missing for the boolean and number arrays.
@jbourquin Just fixed and released the fix here: View at:
https://pypi.org/project/json2xml/3.17.1/
Please test and let me know if it works for you and if you are satisfied if the issue is fixd and there is no edge case remaining, please close this issue.
from json2xml.
@vinitkumar Thank you, yes this fixes my problem. I was actually working on a pull request just before your commit. Here is a unit test for these two issues if you would like to integrate it into your repository:
https://github.com/jbourquin/json2xml/blob/master/tests/test_dicttoxml.py
from json2xml.
@jbourquin Please send me a PR with the tests and I would be more than happy to merge them if I like what I see. Thanks for your hard work.
from json2xml.
@vinitkumar I just tried installing v3.17.1 from PYPI and it seems like the old version of the dicttoxml
module is included in the PYPI download instead of the new one with the array fix.
from json2xml.
@jbourquin Are you sure? I just checked the code and it seems like my patch for it is there.
from json2xml.
@jbourquin Are you sure? I just checked the code and it seems like my patch for it is there.
Ah, I think I understand. What are you are looking for is not implemented in the latest master and has not been released yet. My last fix, made the bool lower case like true
and false
instead of True
or False
.
from json2xml.
Yeah, I'm looking for the array fix you released yesterday
from json2xml.
A new version of json2xml is released https://pypi.org/project/json2xml/3.18.0/
Please check if that fixes your issue.
from json2xml.
Related Issues (20)
- dicttoxml adds 'b...' HOT 4
- setting the xmlns value HOT 6
- setting xsi location HOT 3
- Logging should be disabled by default HOT 4
- Convert a dict with list to json without <list> elements HOT 1
- Wrap list items in their parent element HOT 1
- Ampersand not parsed correctly when attrs are present HOT 1
- List items as tags with arguments HOT 9
- Crash in one test when switching to pytest HOT 1
- dicttoxml: recursive array broken since json2xml 3.19.0 HOT 1
- some unit tests do not fail in test_dict2xml.py but should
- Security issues reported by dlint
- Lower requirements constraints HOT 6
- List items with attributes HOT 10
- not well-formed (invalid token) with custom attrs if attr value has a " character HOT 3
- Movie online database compatibility HOT 1
- validated json fails conversion HOT 4
- @attrs keyword does not work at the root level HOT 1
- Preserve certain text from being escaped HOT 2
- Deprecate setup.py and move to standard based tools
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json2xml.