How to read key_value from the json array

This is my json,

I want to read the values and save into excel.
{
“marketValues”:[
{“location”:“kakinada”,“species”:“shrimp”,“subSpecies”:“bolt shrimp”,“date”:“43799”,“count”:100,“rate”:116,“rateValue”:0},
{“location”:“kakinada”,“species”:“shrimp”,“subSpecies”:“bolt shrimp”,“date”:“43800”,“count”:100,“rate”:129,“rateValue”:0},
{“location”:“kakinada”,“species”:“shrimp”,“subSpecies”:“bolt shrimp”,“date”:“43801”,“count”:100,“rate”:114,“rateValue”:0}
]
}

2 Likes

Hi @sandeep_deshpande

You can check this out for your reference.

https://go.uipath.com/component/convert-json-to-csv

cheers :smiley:

Happy learning :smiley:

@sandeep_deshpande - So this is Json contain a Json array.

So You have use this hierarchy only Let’s say I want **rate ** of the marketValues so these are the steps:

  1. Read the text.
  2. DEserialize the JSON using Deserialize Json Object activity and type argument will be Newtonsoft.Json.LinqJObject result of this activity will be Res
  3. Then use Res(“marketValues”).ToString and save it in variable var1.
  4. Then Use Deserialize Json Array activity with Type Argument and pass the var1 in input and say the output of this activity will be Res2
  5. Then use For Each loop with Newtonsoft.Json.LinqJObject and pass the Res2 in For Each.
  6. In for Each use Write line activity and pass item(“rate”).ToString.

It will print all the rate in console.
Now it’s on you how you want to use it.

Best!!
Anmol

3 Likes

investor.xaml (14.5 KB)

i have done in the way u suggested but getting errors.

“invoked workflow has validation errors ,review workflow and resolve errors”

investor.xaml (6.7 KB) New Text Document.Json (396 Bytes)

Modified your workflow…!

Please have a look @sandeep_deshpande

Thanks!

@sandeep_deshpande - Use Assign activity right after read text file and use this
jsonOp = jsonOP.Replace(“““”,“”“”).Replace(“”””,“”“”).Replace(“�”,“”“”)

thanks bro, but when i run the workflow i am getting below error.

Can you use this file in read text file activity

New Text Document.Json (396 Bytes)

and test once…!

@sandeep_deshpande

Thanks!

Not solved,same error

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.