Raja.G
(Mr.RPABot)
October 25, 2022, 1:13pm
1
Hi Team,
I want read txt and get dictionary value from txt file please help me anyone for this
{
“str_name”:“Arun”,
“str_deft”:“IT”,
“str_location”:“Chennai”
}
Input:
io_config(“str_Name”).ToString
io_config(“str_Deft”).ToString
io_config(“str_location”).ToString
Expected Output :
Arun
IT
Chennai
Regards,
Raja G
Hi @Raja.G ,
Maybe you could try the Following Steps :
Read the text Data to a String variable using Read Text File
Activity, output variable say dataText
.
Next, Use Deserialize Json
Activity to get the output as a JObject variable, say jObj
.
Next, we could use the below Expression to directly convert to a Dictionary type value :
dictJson = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Dictionary(Of string,String))(jObj.tostring)
Here, dictJson
is a variable of type Dictionary(Of String,String)
1 Like
Raja.G
(Mr.RPABot)
October 25, 2022, 1:51pm
4
Hi @supermanPunch ,
It is possible to use dictionary (string , object)?
I want to use string , object
@Raja.G ,
Just Change the Cast to Dictionary(Of String, Object) and check :
Newtonsoft.Json.JsonConvert.DeserializeObject(Of Dictionary(Of String,Object))(jObj.tostring)
1 Like
Raja.G
(Mr.RPABot)
October 25, 2022, 3:31pm
7
Hi @supermanPunch ,
How to get regex value from json
“str_name”:“(?<=hello:)([\S\s]*)”
io_config(“str_name”).ToString
Please help me on this
@Raja.G ,
Since the Initial Requirement is resolved, for Issues considering a different topic, would request you to create a different Topic, so that we could provide individual help there and would avoid confusions for users who would also face the same issue as this Topic / Requirment States.
system
(system)
Closed
October 28, 2022, 4:27pm
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.