1

I created a HTTP

It's Body property returns a JSON hash:

{
    "data": [
      {
        "id": 123456,
        "fullname": "Last, First",
        "code": null,
        "status": 1,
        "self": "https://api.xxx.com/rest/v1.0/xxx/123456",
        "limits": null,
        "accumulated": null,
        "custom_data_field": [
          {
            "id": 4,
            "label": null,
            "value": null
          },
          {
            "id": 5,
            "label": null,
            "value": null
          },
          {
            "id": 6,
            "label": null,
            "value": null
          }
        ],
        "access_groups": []
      }
    ],
    "meta": {
      "previous": null,
      "total": 1,
      "per_page": 50,
      "next": "https://api.xxx.com/rest/v1.0/xxx?page%5Bnumber%5D=2"
    }
}

I would like to loop each items in the data element.

What is the next step? Initialize variable? Append to an array variable? In either case, what's the syntax to get each element's (e.g. data.fullname) value?

1
  • Hi craig, may I know if the solution helps your problem ? If still have any problem or it doesn't meet your requirements, please let me know. Commented May 12, 2020 at 1:40

1 Answer 1

1

As you described in your question, if you want to loop the items in the data element, you just need to use "Parse JSON" action to parse the whole json string. Such as below screenshot(in screenshot I initialize a variable named "source" which store your json string to simulate your situation) enter image description here

In "Parse JSON" action, please click "Use sample payload to generate schema" button and input your json string, it will generate the schema automatically.

Then add a "For each" loop and use the "data" from "Parse JSON" as the element of the loop. enter image description here

In the "For each", you can use any element in the data as shown in the screenshot above.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.