Hi Team,
I need to extract below data from json.
response_1678962644070 (1).json (22.2 KB)
Auth no
Admit date
Servicing Facility Name
Auth Start Date
Auth End date
Status
Thank you in advance
Hi Team,
I need to extract below data from json.
response_1678962644070 (1).json (22.2 KB)
Auth no
Admit date
Servicing Facility Name
Auth Start Date
Auth End date
Status
Thank you in advance
Hi @yashnegi108
Read the JSON file & store it in a string. Convert the string to Json Object using Deserialize JSON activity, save the object in jsonObject variable.
Then you can easily obtain the data ike this:
authNo = jsonObject(âAuth noâ).ToString
admitDate = jsonObject(âAdmit dateâ).ToString
servicingFacilityName = jsonObject(âServicing Facility Nameâ).ToString
authStartDate = jsonObject(âAuth Start Dateâ).ToString
authEndDate = jsonObject(âAuth End dateâ).ToString
status = jsonObject(âStatusâ).ToString
Hope this helps,
Best Regards.
Hii @yashnegi108 ,
Please find the attached workflow
JsonResponse.zip (1.6 KB)
Note : Please install package âUiPath.WebAPI.Activitesâ
According to your input your array is : âipAuthorizationsâ
I have taken only the 0th index values that is :
JsonObject(âipAuthorizationsâ)(0)(âauthorizationNumâ).ToString
if u want to retrive other values you can try by changing the Index to 1 etc
JsonObject(âipAuthorizationsâ)(1)(âauthorizationNumâ).ToString
Hope this helps:
Hi @yashnegi108,
Check this attached flow this will helps you to extract all the information from the JSON
ExtractJson.xaml (8.2 KB)
Thank you Jithesh for you answer. It works
Could you please guide me if we have more dynamic data json string change according inputs like right now we have
*JsonObject(âipAuthorizationsâ)(0) or JsonObject(âipAuthorizationsâ)(1)(âauthorizationNumâ).ToString will change according to inputs.
How will we handle this.
Thank you for your supports
@yashnegi108
welcome to the forum
with deserialize JSON Activity we get back a JObject - myJObject
The returned JObject has under ipAuthorizations an array with 3 class objects
Retrieval Loop Approach ( via Index, or feeding to a for each)
Sample:
Retrieval to DataTable (longer one liner)
JArray.FromObject(myJObject("ipAuthorizations").Values(Of JObject).Select(Function (x) new JObject(x.Properties.Where(Function (p) arrExtract.Contains(p.Name))))).toObject(Of DataTable)
with:
arrExtract
string[6] { "authorizationNum", "admitDate", "servicingFacilityName", "authEndDate", "authStartDate", "status" }
We would recommend to combine both techniques and focus also on datatype specific value retrieval like for dates:
Hii @yashnegi108
Please find the modified workflow
in this flow i have taken the array âipAuthorizationsâ and iterated through all the indexes.
JsonResponse.zip (2.0 KB)
Hope this helps
Hi Jithesh,
Thank you for response. I will not able to open xaml file getting below error. I tried change the package verison web UiPath.
Could not find member âFileâ in type âhttp://schemas.uipath.com/workflow/activities:ReadTextFileâ. Row: 100, Column: 24
[Debug] The restore inputs for âJsonResponseâ have not changed. No further actions are required to complete the restore.
03/18/2023 15:41:45 => [Info] Assets file has not changed. Skipping assets file writing. Path: C:\Users\ynegi\Desktop\JsonResponse.local\AllDependencies.json
03/18/2023 15:41:45 => [Debug] No-Op restore. The cache will not be updated. Path: C:\Users\ynegi\Desktop\JsonResponse.local\nuget.cache
03/18/2023 15:41:57 => [Error] File âJsonResponse.xamlâ - variable âNewArrayâ: Type âs:Stringâ (âclr-namespace:System;assembly=System.Private.CoreLibâ) could not be resolved and was automatically replaced with âUnknownTypeâ
03/18/2023 15:41:57 => [Error] Could not find member âSettingsâ in type âErrorâ. Row: 1, Column: 61
03/18/2023 15:41:57 => [Error] Could not find type âSystem.Collections.Generic.List(String)â in assembly âSystem.Private.CoreLibâ. Row: 3, Column: 6
03/18/2023 15:41:57 => [Error] Could not find type âSystem.Collections.Generic.List(AssemblyReference)â in assembly âSystem.Private.CoreLibâ. Row: 39, Column: 6
03/18/2023 15:41:57 => [Error] Could not find type âSystem.Collections.Generic.Dictionary(String,Object)â in assembly âSystem.Private.CoreLibâ. Row: 77, Column: 8
03/18/2023 15:41:57 => [Error] Could not find member âFileâ in type âhttp://schemas.uipath.com/workflow/activities:ReadTextFileâ. Row: 100, Column: 24
03/18/2023 15:41:57 => [Error] Could not find member âSettingsâ in type âErrorâ. Row: 1, Column: 61
03/18/2023 15:41:57 => [Error] Could not find type âSystem.Collections.Generic.List(String)â in assembly âSystem.Private.CoreLibâ. Row: 3, Column: 6
03/18/2023 15:41:57 => [Error] Could not find type âSystem.Collections.Generic.List(AssemblyReference)â in assembly âSystem.Private.CoreLibâ. Row: 39, Column: 6
03/18/2023 15:41:57 => [Error] Could not find type âSystem.Collections.Generic.Dictionary(String,Object)â in assembly âSystem.Private.CoreLibâ. Row: 77, Column: 8
03/18/2023 15:41:57 => [Error] Could not resolve type âErrorâ because could not find one or more of its type arguments. Row: 91, Column: 10
03/18/2023 15:41:57 => [Error] Could not find type âSystem.Stringâ in assembly âSystem.Private.CoreLibâ. Row: 91, Column: 10
03/18/2023 15:41:57 => [Error] Could not find member âFileâ in type âhttp://schemas.uipath.com/workflow/activities:ReadTextFileâ. Row: 100, Column: 24
Hi Jithesh,
Thank you for reply and I am not able to open .xmal file. getting Errors. Could you resent the .xaml. It will be great and support