cancel
Showing results for 
Search instead for 
Did you mean: 

PI 7.5 Sender REST Adapter JSON Array Generate Problem

0 Kudos

Hello,

Trying to get a JSON strucure like this;

{
	"DATA": [
		"TRL",
		"TRL",
		[
			{
				"A": "0",
				"B": 0
			},
			{
				"A": "01",
				"B": 1
			},
			{
				"A": "02",
				"B": 8
			},
			{
				"A": "03",
				"B": 18
			}
		],
		[
			{
				"A": "EUR",
				"B": "E",
				"C": 2,
				"D": "EUR"
			},
			{
				"A": "USD",
				"B": "A",
				"C": 2,
				"D": "USD"
			}
		]
	}
}

But i just got this with XSLT mappings; just need first { "DATA": [ part. I don't need other "DATA": parts. Just array is ok, no need object with name.

{
	"DATA": [
		"TRY",
		"TRY",
		{
			"DATA": [
				{
					"A": 0,
					"B": 0
				},
				{
					"A": 1,
					"B": 1
				},
				{
					"A": 2,
					"B": 8
				},
				{
					"A": 3,
					"B": 18
				}
			]
		},
		{
			"DATA": [
				{
					"A": "EUR",
					"B": "E",
					"C": 2,
					"D": "EUR"
				},
				{
					"A": "USD",
					"B": "A",
					"C": 2,
					"D": "USD"
				}
			]
		}
	]
}


My last XML structure like this; [all DATA 0...Unbounded]

<DATA>
	<DATA>
		<DATA>TRY</DATA>
		<DATA>TRY</DATA>
		<DATA>
			<DATA>
				<A>0</A>
				<B>0</B>
			</DATA>
			<DATA>
				<A>01</A>
				<B>1</B>
			</DATA>
			<DATA>
				<A>02</A>
				<B>8</B>
			</DATA>
			<DATA>
				<A>03</A>
				<B>18</B>
			</DATA>
		</DATA>
		<DATA>
			<DATA>
				<A>EUR</A>
				<B>E</B>
				<C>2</C>
				<D>EUR</D>
			</DATA>
		</DATA>
		<DATA>
			<DATA>
				<A>USA</A>
				<B>A</B>
				<C>2</C>
				<D>USD</D>
			</DATA>
		</DATA>
	</DATA>
</DATA>

Using configuration to strip root DATA node from structure.

How can i create JSON array with no name like this? (i mean just array not object)

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Problem solved.

This structure cannot generate from XML. I use XSLT mapping to generate RAW JSON and do not use "Convert XML Payload to JSON"

Answers (0)