Unable to get all values from json object

Hi,
I’m trying to read and write to csv values from a json object. But dynamic array has values from 0…n and don’t know how to read all the values. I’m tryin to get values from "auxiliaryNames element.

I’m trying to do it like this:
For each item in myvariable(“results”)
assign auxiliaryNames = myvariable(“auxiliaryresults”)(0)(“name”).tostring

Activity requires the index and I don’t know how to manage this.

{
  "type": "fi.prh.opendata.tr",
  "version": "1",
  "totalResults": -1,
  "resultsFrom": 0,
  "previousResultsUri": null,
  "nextResultsUri": null,
  "exceptionNoticeUri": null,
  "results": [
    {
      "businessId": "0152343-6",
      "name": "Henkel Finland Oy",
      "registrationDate": "1896-10-23",
      "companyForm": "OY",
      "detailsUri": "http://avoindata.prh.fi/opendata/tr/v1/0152343-6",
      "bisDetailsUri": "http://avoindata.prh.fi/opendata/bis/v1/0152343-6",
      "language": "SE",
      "latestRegistrationDate": "2019-06-29",
      "checkDate": null,
      "names": [
        {
          "order": 0,
          "name": "Henkel Finland Oy",
          "registrationDate": "2017-01-01",
          "endDate": null,
          "language": null
        }
      ],
      "auxiliaryNames": [
        {
          "order": 1,
          "name": "Henkel Cosmetic",
          "registrationDate": "1998-03-31",
          "endDate": null,
          "language": null
        },
        {
          "order": 2,
          "name": "Henkel Fincos",
          "registrationDate": "1998-03-31",
          "endDate": null,
          "language": null
        },
        {
          "order": 3,
          "name": "Tam-Kos",
          "registrationDate": "1998-03-31",
          "endDate": null,
          "language": null
        },
        {
          "order": 4,
          "name": "To-Lu",
          "registrationDate": "1998-03-31",
          "endDate": null,
          "language": null
        },

@hemuli
If you need to get the index of a specific jArray item you can doIndexOf("your_string") which will return the integer index of the jArray item with that id. However, in this case I think you may just need to parse one more time with the Deserialize Json Array activity. Check the attached .xaml and let me know if that helps you out.

Main.xaml (10.1 KB)

From the above JSON, if you want to get the name which is there inside the results array, this will work @hemuli

obj.Item(“results”)(0).Item(“name”)

1 Like

Hi, and thanks for your reply! It wasn’t straight forward the resolution, but I got the idea from your reply. Thanks a lot :slight_smile:

I only had to do the http request —>Deserialize json–>for eac
Capture

1 Like

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