How to use Hmap - JSON to XML

Six Stars

How to use Hmap - JSON to XML

How to setup HMap to be able to create the XML from the following JSON?

Untitled.png

 

Input JSON

{
	"documentSection":{
		"documentStatus": 1,
		"documentNumber": "9300806055"
	},
	"partnerSection": {
		"partner_role_ag": {
			"partnerRole": "AG",
			"contactFirstName": "Mario"
		},
		"partner_role_lf": {
			"partnerRole": "LF",
			"contactFirstName": "Anna"
		},
		"partner_role_we": {
			"partnerRole": "WE",
			"contactFirstName": "Mia"
		}
	}
}

Output XML:

<ORDER>
	<HEAD>
		<DOC_STATUS>1</DOC_STATUS>
		<DOC_NO>9300806055</DOC_NO>
		<PARTY>
			<PARTNER_ROLE>AG</PARTNER_ROLE>
			<NAME1>Mario</NAME1>
		</PARTY>
		<PARTY>
			<PARTNER_ROLE>LF</PARTNER_ROLE>
			<NAME1>Anna</NAME1>
		</PARTY>
		<PARTY>
			<PARTNER_ROLE>WE</PARTNER_ROLE>
			<NAME1>Mia</NAME1>
		</PARTY>
	</HEAD>
</ORDER>

 


Accepted Solutions
Nine Stars

Re: How to use Hmap - JSON to XML

I enclosed a map and a job to do this transform.


All Replies
Nine Stars

Re: How to use Hmap - JSON to XML

Hi,

 

How do you get this JSON input ? Do you read it on a file system ? Does it come from a webservice call ? ...

 

Eric

Six Stars

Re: How to use Hmap - JSON to XML

web service call, but why does that matter?

Nine Stars

Re: How to use Hmap - JSON to XML

I enclosed a map and a job to do this transform.

Six Stars

Re: How to use Hmap - JSON to XML

Are there any good example & documentation on how to use tHMap? I remember that 6 months ago there were almost no examples.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read