Skip to Content
avatar image
Former Member

PI 7.5 Sender REST Adapter JSON Array Generate Problem

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Aug 06, 2017 at 05:01 PM

    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"

    Add comment
    10|10000 characters needed characters exceeded