Skip to Content
0

Data type structure for JSON structure

May 17, 2017 at 09:48 AM

45

avatar image

Dear All.

How to create data type for the below JSON format.

[
{"Originator_Id":12345,
"Originator_Pan":"123456789",
"Counter_Party_Id":1234567,
"Uploaded_Doc_Type":"fgh",
"LineItems":[
{
"Originator_Id":12345,
"Originator_Pan":"123456789",
"Invoice_No":"sadfasdf",
"Description_Of_Goods":"asdfasdf"
},
{
"Originator_Id":12345,
"Originator_Pan":"123456789",
"Invoice_No":"sadfasdf",
"Description_Of_Goods":"asdfasdf"
}
],
"Created_By":"sys",
"Data_Source":"sys"
           },
{"Originator_Id":12345,
"Originator_Pan":"123456789",
"Counter_Party_Id":1234567,
"Uploaded_Doc_Type":"fgh",
"LineItems":[
{
"Originator_Id":12345,
"Originator_Pan":"123456789",
"Invoice_No":"sadfasdf",
"Description_Of_Goods":"asdfasdf"
},
{
"Originator_Id":12345,
"Originator_Pan":"123456789",
"Invoice_No":"sadfasdf",
"Description_Of_Goods":"asdfasdf"
}
],
"Created_By":"sys",
"Data_Source":"sys"
           }
]

when i do convert above JSON to xml i'm getting and below xml

<?xml version="1.0" encoding="UTF-8" ?>
<0>
	<Originator_Id>12345</Originator_Id>
	<Originator_Pan>123456789</Originator_Pan>
	<Counter_Party_Id>1234567</Counter_Party_Id>
	<Uploaded_Doc_Type>fgh</Uploaded_Doc_Type>
	<LineItems>
		<Originator_Id>12345</Originator_Id>
		<Originator_Pan>123456789</Originator_Pan>
		<Invoice_No>sadfasdf</Invoice_No>
		<Description_Of_Goods>asdfasdf</Description_Of_Goods>
	</LineItems>
	<LineItems>
		<Originator_Id>12345</Originator_Id>
		<Originator_Pan>123456789</Originator_Pan>
		<Invoice_No>sadfasdf</Invoice_No>
		<Description_Of_Goods>asdfasdf</Description_Of_Goods>
	</LineItems>
	<Created_By>sys</Created_By>
	<Data_Source>sys</Data_Source>
</0>
<1>
	<Originator_Id>12345</Originator_Id>
	<Originator_Pan>123456789</Originator_Pan>
	<Counter_Party_Id>1234567</Counter_Party_Id>
	<Uploaded_Doc_Type>fgh</Uploaded_Doc_Type>
	<LineItems>
		<Originator_Id>12345</Originator_Id>
		<Originator_Pan>123456789</Originator_Pan>
		<Invoice_No>sadfasdf</Invoice_No>
		<Description_Of_Goods>asdfasdf</Description_Of_Goods>
	</LineItems>
	<LineItems>
		<Originator_Id>12345</Originator_Id>
		<Originator_Pan>123456789</Originator_Pan>
		<Invoice_No>sadfasdf</Invoice_No>
		<Description_Of_Goods>asdfasdf</Description_Of_Goods>
	</LineItems>
	<Created_By>sys</Created_By>
	<Data_Source>sys</Data_Source>
</1>


if we see the above xml we are getting an segment name as the counter value.

1. how we can handle this kind of JSON format? how the data type looks like?

2. how to use "[" square bracket concept in the rest scenario?

Please do needful.

Regards

Ramesh

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers