I want to extract array from json file

OK, yes you will need to convert the data back from string to array format. Here is what I recommend:

Go to Pre-request Script tab of the Create Role request, and insert the following code:

// Get rolepermission data (currently stored as string)
var roles = pm.iterationData.get("rolepermission");

// Convert roles back to a JSON array
pm.globals.set("rolepermission_array", JSON.stringify(roles));

Then you should modify the Create Role body to use this new array variable:

{
  "role": {
    "name": "{{rolename}}",
    "description": "{{roledescription}}",
    "permissions": {{rolepermission_array}},
    "userType": "{{roletype}}"
  }
}

Now you should find that the structure of your permissions is correct :slightly_smiling_face:

1 Like