Hello all,
how to add complex json to UiPath queue without go for each item in the json
my json quite complex has multiple arrays is there direct way then i use item.spesfic content?
if yes please let me know how .
Hello all,
how to add complex json to UiPath queue without go for each item in the json
my json quite complex has multiple arrays is there direct way then i use item.spesfic content?
if yes please let me know how .
Please share the sample JSON with us as a solutions depends on the JSON structure details
to add a complex JSON to a queue without iterating through specific content, use the “Add Queue Item” activity, and set the ItemInformation property’s Content field to your complex JSON. This will add the entire JSON as a single queue item.
cheers…!
do i just drop the json object!
please share !
Hi,
here is sample IncomingTerritories and outgoing can be 30 item in the array same as Accounts
{
“SolutionId”: “SOL-1233-BC”,
“CustomerName”: “Haz-sal”,
“CustomerType”: “Investment Fund”,
“StreetAddress”: “malmo”,
“City”: “Shanyview”,
“PostalCode”: “15488”,
“Country”: “sweden”,
“CountryCode”: “TN”,
“RiskLevel”: “Medium-High”,
“BranchCode”: “010”,
“CountryOfIncorporation”: “TN”,
“IncomingTerritories”: [
{
“CountryCode”: “DE”
}
],
“OutgoingTerritories”: [
{
“CountryCode”: “AD”
}
],
“PaymentForecast”: {
“MaxMonthlyPayments”: 0,
“MaxSinglePayment”: 0,
“VolumePerMonth”: 0
},
“PricingCurrency”: “USD”,
“MarginPercentageCategory1”: 1.9,
“MarginPercentageCategory2”: 1.9,
“MarginPercentageCategory3”: 1.9,
“Accounts”: [
{
“AccountTypeId”: 6,
“AccountType”: “Funds Account”,
“Currency”: “USD”,
“SafeGuard”: true
},
{
“AccountTypeId”: 4,
“AccountType”: "Fee ",
“Currency”: “MXN”,
“SafeGuard”: true
}
]
}
There are several options
However lets focus an additional Approach
Convert the JSON into a Dictionary(Of String, Object)
dictSPC =
Newtonsoft.Json.JsonConvert.DeserializeObject(Of Dictionary(of String, Object))(txtJSON)
Unfortunately we cannot use directly when adding the QueueItem
But with the following Reconversion we can use it later
dictSPC2 | Dictionary(Of String, Object) =
dictSPC.Select(Function (x) new KeyValuePair(Of String, Object)(x.Key, x.Value.toString)).ToDictionary(Function (x) x.Key, Function (x) x.Value)
then add it to the Queue
Result in ORC:
When retrieving the QueueItem we get:
And can use this string to parse it into a JArray back like:
Samples done within the immediate Panel:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
Thanks a lot will definitely try it today
Sorry my mistake ignore this
The first parts worked great but an issue when i add the queue item
What should be the type here !
dictionary ?
We would suggest to still use the dictSPC2 as a Dictionary(Of String, Object) and place it under the ItemInformationCollection
Additional Data you can add before by using
Assign Activity
dictSPC2(“YourKey”) = YourValue
e.g.
dictSPC2(“ClientID”) = “#123456”
Big Thanks you made its so clear and easy
one question is it possible to loop through
in_Transactionitem.specific.content(“Accounts”) for example or should i get all and set them to a table !
Thanks
assumption as described above. The QueueItem SpecificContent reflect the json. But deeper nested structures are serialized as mentioned here:
So for the accounts
Visual Reminder:
we can do (Jarray Parsing)
Quick Datatable Conversion
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.