public class Json2XmlConverter extends Object
See json.org for the JSON grammar. This implementation will also accept strings that do not quote their field names.
The current implementation creates a child element for each element of an array, producing output similar to that from the Bean->XML conversion.
Constructor and Description |
---|
Json2XmlConverter(String src,
Json2XmlOptions... options) |
Modifier and Type | Method and Description |
---|---|
Element |
convert()
Creates a new XML
Document from the JSON source string. |
void |
convert(Element parent)
Parses the JSON source string and appends its contents to the passed
element.
|
Element |
convert(String localName)
Creates a new XML
Document from the JSON source string. |
Element |
convert(String nsUri,
String qname)
Creates a new XML
Document from the JSON source string. |
public Json2XmlConverter(String src, Json2XmlOptions... options)
public Element convert()
Document
from the JSON source string.
The root element of this document will be named "data"; descendent
elements will be named per the JSON content.public Element convert(String localName)
Document
from the JSON source string.
The root element of this document will be given the specified name,
without namespace; descendent elements will be named per the JSON
content, also without namespace.public Element convert(String nsUri, String qname)
Document
from the JSON source string.
The root element of this document will be given the specified name
and namespace; descendent elements will be named per the JSON
content, and will inherit the namespace and prefix.public void convert(Element parent)