duaine.b
(D)
November 9, 2023, 10:22am
1
Hi I wanted to merge two Jobjects into 1
initial Jobject:
{
“GUID”: “e080fdc6-20e2-4661-bb45-df27fb58d619”,
“ClientInfo”: {
“DelphiScore”: “999”,
“DocumentKey”: “76149c73-45de-477c-bc27-0a8f2f6ad46b”,
“DocumentUrl”: “Test document via API.pdf”
}
the second jobejct: {
“InsuredCompaniesInfo”: [
{
“InsuredCompanyId”: 138,
“CompanyInfo”: {
“DelphiScore”: “123”,
“DocumentKey”: “76149c73-45de-477c-bc27-0a8f2f6ad46b”,
“DocumentUrl”: “Test document via API.pdf”
}
},
{
“InsuredCompanyId”: 139,
“CompanyInfo”: {
“DelphiScore”: “456”,
“DocumentKey”: “76149c73-45de-477c-bc27-0a8f2f6ad46b”,
“DocumentUrl”: “Test document via API.pdf”
}
}
]
}
the jobect id like to create once merged:
{
“GUID”: “e080fdc6-20e2-4661-bb45-df27fb58d619”,
“ClientInfo”: {
“DelphiScore”: “999”,
“DocumentKey”: “76149c73-45de-477c-bc27-0a8f2f6ad46b”,
“DocumentUrl”: “Test document via API.pdf”
},
“InsuredCompaniesInfo”: [
{
“InsuredCompanyId”: 138,
“CompanyInfo”: {
“DelphiScore”: “123”,
“DocumentKey”: “76149c73-45de-477c-bc27-0a8f2f6ad46b”,
“DocumentUrl”: “Test document via API.pdf”
}
},
{
“InsuredCompanyId”: 139,
“CompanyInfo”: {
“DelphiScore”: “456”,
“DocumentKey”: “76149c73-45de-477c-bc27-0a8f2f6ad46b”,
“DocumentUrl”: “Test document via API.pdf”
}
}
]
}
1 Like
ppr
(Peter Preuss)
November 9, 2023, 10:26am
2
can you check the description? At the first look the second JObject looks same as the expected output JObject
duaine.b
(D)
November 9, 2023, 10:27am
3
Thanks i have now corrected this
ppr
(Peter Preuss)
November 9, 2023, 10:34am
4
give a try at:
And set the parameters as described here in the docu:
@duaine.b
you can merge two JSON objects using in an Assign activity:
mergedJsonObject = JObject.FromObject(JsonConvert.DeserializeObject(Of Dictionary(Of String, Object))(jsonObject1)).Merge(JObject.FromObject(JsonConvert.DeserializeObject(Of Dictionary(Of String, Object))(jsonObject2)))
once try this
cheers…!
duaine.b
(D)
November 10, 2023, 1:12pm
6
I’m receiving this error when I try
NewtonsoftIson.LingJObjecttoString:Option Strict On disallows implicit conversions from Newtonsoft.son.linqObject’to’String
ppr
(Peter Preuss)
November 10, 2023, 1:42pm
7
The Merge Method from newtonsoft (link from above) is a so called void method. In VB.Net world a so called sub / subroutine and is not a function returning a value.
A BC30491 Expression does not produce a value will be raised.
Therefore we cannot use within an Assign Activity and Invoke Method was suggested
Above error is about datatype missmatch of a JObject and String
We will ignore the unneded conversions from JO to a serialized JSON to get it again Deserialized
myJO1.Merge(myJO2) it the same in short
myJO1.Merge(myJO2).ToString would haromize the DataType missmatches (JSON String returned)
But will not work as elaborated above: BC30491 issue
ppr
(Peter Preuss)
November 10, 2023, 1:53pm
8
to elaborate more the above:
The simple one without additiona mergesetting configurations:
JO2 will be merged to JO1
1 Like
duaine.b
(D)
November 10, 2023, 4:36pm
9
This is brillant, i really appreciate the support Peter!! I’ve been struggling with this for months now!
system
(system)
Closed
November 13, 2023, 4:36pm
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.