Code Monkey home page Code Monkey logo

Comments (10)

EstherFranssen avatar EstherFranssen commented on August 14, 2024 1

Yes, thanks this would suit for what I want to achieve

from json2xml.

EstherFranssen avatar EstherFranssen commented on August 14, 2024

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.

javadev avatar javadev commented on August 14, 2024
{ 
  "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.

Jeroendevr avatar Jeroendevr commented on August 14, 2024

@javadev what do you mean with your comment? An example of the code behaviour at the moment?

from json2xml.

Jeroendevr avatar Jeroendevr commented on August 14, 2024

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.

Jeroendevr avatar Jeroendevr commented on August 14, 2024

I see @EstherFranssen That your suggestion is similar to option 5 so I think I'll make an attempt at it.

from json2xml.

vinitkumar avatar vinitkumar commented on August 14, 2024

from json2xml.

Jeroendevr avatar Jeroendevr commented on August 14, 2024

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.

vinitkumar avatar vinitkumar commented on August 14, 2024

@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.

EstherFranssen avatar EstherFranssen commented on August 14, 2024

Thanks @vinitkumar, @Jeroendevr, this is great!

from json2xml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.