JSON to XML
Description
JSON to XML (uv-t-jsonToXml):
Converts JSON data (e.g. responses to REST services) to XML, so that it can be further processed, e.g., by XSLT.
Configuration Parameters
Name | Description |
---|---|
URL Prefix | Param which automatically replaces the defined URL with a whitespace |
Inputs and Outputs
Name | Type | DataUnit | Description | Required |
---|---|---|---|---|
input | i | FilesDataUnit | Input JSON files | |
output | o | FilesDataUnit | Produced XML data |
Examples
Perform an API Request to PoolParty and Transform the JSON Response Into XML
The following image shows a pipeline which performs an API request to PoolParty, transforms the JSON response to XML, and converts this XML into RDF/XML.
The configuration of the DPU can be seen in the image below.
The URL Prefix allows you to automatically replace a part of text/URL with a whitespace. This is useful when you work with custom attributes URLs as when these are converted to XML format the first slash from http:/ will then break in the text causing an output of unwanted XML data.
e.g.
{ "uri": "http://vocabulary.semantic-web.at/cocktails/0bbdca98-077b-48d1-99d6-47eca59c442c", "prefLabel": "Aviation", "http://vocabulary.semantic-web.at/cocktail-ontology/image": [ "https://upload.wikimedia.org/wikipedia/commons/4/4f/Aviation_Cocktail.jpg" ] }
<root> <http:>https://upload.wikimedia.org/wikipedia/commons/4/4f/Aviation_Cocktail.jpg</http:> </root>
This is unwanted and is difficult to further transform due to the nature of needing to encode character breaks to handle this cause.
With the usage of the URL Prefix field we are able to have a better generated XML tag.
e.g.
<root> <image>https://upload.wikimedia.org/wikipedia/commons/4/4f/Aviation_Cocktail.jpg</image> </root>