javadev / underscore-java

java port of Underscore.js
https://javadev.github.io/underscore-java/
MIT License
533 stars 80 forks source link

JSON to XML conversion #278

Closed sreekanthpld closed 3 years ago

sreekanthpld commented 3 years ago

I have a json { "a":"value"}. I need to convert to xml like

javadev commented 3 years ago

Hi,

Thank you for the question.

You may call U.jsonToXml(json).

Resulted xml:

<?xml version="1.0" encoding="UTF-8"?>
<a>value</a>
sreekanthpld commented 3 years ago

Hi - Can I make it in tag rather than element. like this **<root a="value" />**

javadev commented 3 years ago

You may try this json

{ "-a":"value"}