Comments (10)
Yes, thanks this would suit for what I want to achieve
from json2xml.
After consideration, it is not completely what I need.
Below a possible solution:
{
'searchword' : [
{'@attrs': {'xml:lang': 'nl'}, '@val': 'Adembescherming'},
{'@attrs': {'xml:lang': 'en'}, '@val': 'Breathing protection'}
]
}
Which should result in:
<searchword xml:lang="nl">Adembescherming</searchword>
<searchword xml:lang="en">Breathing protection</searchword>
I hope this helps
from json2xml.
{
"vehicle" : {
"attrs": "transportation-mode",
"val": ["Bike", "Bus", "Tram"]
}
}
may be converted to
<?xml version="1.0" encoding="UTF-8"?>
<vehicle>
<attrs>transportation-mode</attrs>
<val>Bike</val>
<val>Bus</val>
<val>Tram</val>
</vehicle>
from json2xml.
@javadev what do you mean with your comment? An example of the code behaviour at the moment?
from json2xml.
Too many implementation possibilities ๐คจ. Although I have yet to find out which could be implemented at all, I don't have a strong preference yet.
@vinitkumar Could you give your opinion about a possible implementation ๐ง. You possibly have a better understanding about the feasibility.
from json2xml.
I see @EstherFranssen That your suggestion is similar to option 5 so I think I'll make an attempt at it.
from json2xml.
from json2xml.
Nice, awesome. I have added a PR with a unit test if we are going for option 5. Let me know if I can do anything else for you.
from json2xml.
@EstherFranssen A new release of json2xml has been released and thanks to the great work of @Jeroendevr, we have list with attributes support live.
Please grab the latest code from https://json2xml.readthedocs.io/en/latest/, https://pypi.org/project/json2xml/3.21.0/ and see if it solves your use case. If there are some bugs, please create a ticket.
from json2xml.
Thanks @vinitkumar, @Jeroendevr, this is great!
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
- 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.