Both XML and JSON are used almost every application. Converting xml to json is very common ask. XML To JSON Converter tool converts Xml to Json string. It converts XML content to JSON string. It can be used online. No need to download it. It has given one example also by defaut. It's implementation algorithim has been developed using Java. Takes XML as input and produces JSON string. It provides the option to add thrird bracket('[') for repetitive elelemts in XML.
Click
Here To Watch A Demo On It(https://youtu.be/mdEH_XUigRU).
How It Works:
XML and JSON :
XML - is an extensible markup language which is used to exchange data
between applications. Its like HTML but does not have any predefied tag.
JSON- is the JavaScript Object Notation and is the lightweight format
for exchanging data. It first validate the input XML String and analyse
it. It extracts the attributes and its values from the XML. Form the
JSON string.
XML To JSON converter tool converts the XML string to its equivalent
JSON format. It parse the input XML string. Analyse the elements and
attributes. then converts xml attributes to the JSON keys with the
prefix “-”.
Parameters are:
- XML: Source XML content.
- Remove Root Element Name: Whether to remove the root element
name from the output JSON string or not.
- Add '[]': Whether to add the '[' ']' when there is a JSON
array.
Steps to follow:
- Put XML content in the text area.
- Check the checkbox 'Add '[' When Repeatative Element Is
There']' .
- Click on 'XML To JSON' button. Generated JSON will be
displayed in the next page in a text area.
- Copy and save it..
XML file which has been used here:
<?xml version="1.0" encoding="UTF-8"?>
<Author DOB="" EMailID="" SSN="">
<Extn ExternalSystemCode=""/>
<Books>
<Book BookNo="1" Name="" PublisherCode="">
<Extn ExtnGiftCoverCode=""/>
<Price DiscountPercentage="" ListPrice="" UnitOfMeasure=""/>
</Book>
</Books>
</Author>
<?xml version="1.0" encoding="UTF-8"?>
<Employee dateOfJoining="" department="" designation="" employeeNo="" firstName="" lastName="">
<dependants>
<dependant age="" location="" name="" relation="">
<mediclaimPolicy coverageDetails="" endDate="" policyName="" policyNo="" startDate="" sumInsuredAmt=""/>
</dependant>
</dependants>
</Employee>
Rules Used:
- Attributes are treated as regular JSON properties
- Terminal #text item types is converted into a JSON property.
- Namespaces are ignored.
- Attribute name starting with '_' is treated as element in the
target XML.
- Produces two JSON, One with same case. Another with XML Case
(First letter of element and attribute in the target xml will be in
upper case)