GithubHelp home page GithubHelp logo

trey-jones / xml2json Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hay/xml2json

2.0 2.0 0.0 104 KB

Python script converts XML to JSON or the other way around

Home Page: http://github.com/hay/xml2json

Python 100.00%

xml2json's Introduction

XML2JSON

Python script converts XML to JSON or the other way around

Usage

Make this executable

$ chmod u+x xml2json3

Then invoke it from the command line like this

$ xml2json3 file.xml file.json

Or the other way around

$ xml2json3 -m json file.json file.xml

You can also output to stdout

$ xml2json3 -m json file.json console

Possibly more info in help:

$ xml2json3 -h

Consider putting the script on your path! I have it in ~/bin

More info

Rewritten to a command line utility by Hay Kranen: http://www.haykranen.nl

Fork it on Github: http://github.com/hay/xml2json

Rewritten by Trey Jones for Python3 with a goal of parsing huge (many Gigs) XML files, specifically for using OSM data in Cartagen (https://github.com/jywarren/cartagen/).

@ and # prefixes for attributes and text/tail respectively removed in this version.

We can correctly parse json to xml without them.

Examples

<e/> => "e": null
<e>text</e> => "e": "text"
<e name="value" />  => "e": {"name": "value"}
<e name="value">text</e> => "e": {"name": "value", "text": "text"}
<e><a>text</a><b>text</b></e> => "e": {"a": "text", "b": "text"}
<e><a>text</a><a>text</a></e> => "e": {"a": ["text", "text"]}
<e>text<a>text</a></e> => "e": {"text": "text", "a": "text"}

xml2json's People

Contributors

hay avatar trey-jones avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.