Hi,
I'm getting the below json format while converting the xml to json...
"Packages":
{
"PackageOccurrence": 1,
"PackagingId": "",
"Weight": 0.75,
"Length": 15,
"Width": 15,
"Height": 15
},
"Items":
{
"ItemId": "",
"Quantity": 1,
"Description": "White Tee-shirt",
"Value": 100,
"Weight": 0.75,
"PackageOccurrence": 1,
"HsCode": "652534",
"SkuCode": "SKU3455692",
"CountryOfOrigin": "CN",
}
using the below code for convertion
string jsonText = JsonConvert.SerializeXmlNode(doc);
JObject json = JObject.Parse(jsonText);
But my expected outcome should be as :
"Packages":
[
{
"PackageOccurrence": 1,
"PackagingId": "",
"Weight": 0.75,
"Length": 15,
"Width": 15,
"Height": 15
}
]
"Items":
[
{
"ItemId": "",
"Quantity": 1,
"Description": "White Tee-shirt",
"Value": 100,
"Weight": 0.75,
"PackageOccurrence": 1,
"HsCode": "652534",
"SkuCode": "SKU3455692",
"CountryOfOrigin": "CN",
"ImageUrl": "http://www.myimagestore.com/myimage.jpg"
}
]
is there any solution available for converting json property as array ?
What I have tried:
JObject Shipper = (JObject)rss["Shipment"];
Shipper.Property("Packages").ToArray();
Shipper.Property("Items").ToArray();
jsonText = rss.ToString();
but its not working for me