How to get the each values seperaterly into variable from the json below

How to get the each values seperaterly into variable from the json below.

Output should e.g. Var1 = 1 and Var2 = 10
Var1 = 2 and Var2 = 5
Var1 = 3 and Var2 = 1
Var1 = 4 and Var2 = 4
Var1 = 5 and Var2 = 25

Input Json =
{
“1”: 10,
“2”: 5,
“3”: 1,
“4”: 4,
“5”: 25
}

wondering how that is even Key & Value pair

but you can use deserialize json activity from uiPath.Web.Actvities and you eill find the next steps easily as you can have it converted into the common datataypes datatable or even string

@rahulsharma - Could you please share the steps I tried but not working.

can you share the json as txt, that would help to be quick

Processing: input.txt…

@pmshinde8051
Option 1: Dict
grafik

e.g. assign activity: dictData = JsonConvert.DeserializeObject(Of Dictionary(Of String, Int32))(strJSON).

access:
first Key: dictData.ElementAt(0).Key
first Value: dictData.ElementAt(0).Value

Option 2: Tuple List
Deserialize JSON string with Deserialize JSON activity - myJObject
grafik

TupleList = myJObject.Properties.Select(Function (x) Tuple.Create(x.Name,Cint(x.Value))).toList
access:
first Key: TupleList(0).item1 - returns a string
first Value: TupleList(0).item2 - returns an int32

we would suggest to have it in place of a datatype holding all values. But when it is be used within a loop, we can adopt the approach as well

1 Like