I am working on a jsonfile and I should be able to get the values from the excel to this existing json and the sample json looks like below:
{
“id”: “1”,
“s1”: “t1”,
“s2”: “t2”,
“s3”: “t3”,
“fa1”: “1”,
“s4”: “1”,
“s5”: “1”,
“cc1”: {
“sk1”: “t4”,
“ac1”: “if”,
“pr1”: “t5”,
“gr1”: 1,
“cu1”: “re”,
“po1”: “t6”,
“cr1”: fa2,
“ad1”: {
“se1”: fa3,
“ch1”: [
“ch2”
],
“se2”: 1,
“en2”: t7
}
},
“sy1”: {
“al1”: “t8”,
“re1”: ,
“re2”: ,
“en3”: {
“01”:
}
},
“mi4”: {
“a1”: 1,
“gr1”: 5
},
“ex1”: {
“le1”: [
“Cu3”
],
“col2”: [
“S1”
]
},
“SS1”: ,
“CI2”: ,
“ip3”: {
“wh1”: [
“::9”
],
“bl2”: ,
“ra3”: {
“mi6”: 60,
“ra2”: 5
}
},
“ur3”: “http://abcdefgh.xyz:11111”,
“enr1”: [
“Mem1”,
“La1”,
“xyz”,
“abc”,
“qwer”
]
}
While i am taking the values from excel, deserializing the json and mapping the key n value in another datatable and trying to update it using a Invoke Method activity in the existing json i have encountered multiple errors as mentioned below:
For gr1 which is present under 2 different keys still i get “Keys should be unique”.
For the ::9 and the link http://abcdefgh.xyz:11111 throws up error and unless i dont remove the issue still persists.
For enr1 ,while mapping in a datatable the values in it are getting typed in a single line. Whereas it should be the same as it looks in the json.
There’s no conversion … I am just taking the values provided in excel to a datatable and mapping the keys to these values. So that Invoke method activity can replace the existing values and update it back in the json with the latest values.
Is that helpful?
Since its for each value in data table, am using a Invoke Method inside a for each row in data table
TargetObject =obj1.SelectToken(currentrow(“Values”).ToString)
Methodname = Replace
Parameters =JToken.FromObject(dtvalue(currentrow(“Keys”).toString))