Help with JSON HTTP Request Activity

Hello,

Can anyone help with this issue I’m having? I don’t know what to do with these “array brackets”. The notepad text on the right is a copy of the object API when I do an “inspect” in Chrome. The second picture is from the browser inspection.

I was able to make other API requests work, but this is the first time I’ve run into the brackets. Sorry, I’m a little new to building a JSON in UiPath.

Any help is greatly appreciated, thanks!

image

Hi @Josh_James ,

When I mapped it to a Similar Sample Structure, I could get the value using the Index post converting to a json object :
image

Let us know if the method does not work.

Hi @supermanPunch ,

What does your expression look like in Studio? That is the part I’m having trouble with. I can’t figure out how to make this work with key .modesToUnsubscribe = ??

it sounds like you want to construct a JObject used for the request body. For this, we would recommend the following alternates:

  • setting up a text template in JSON and replace placeholders with values

OR

  • construct a JObject by the scratch

OR

keys modesToUnsubscribe = "[ ""SMS"" ]" / modesToUnsubscribe = new String(){"SMS"}

1 Like

Hi @ppr ! Thank you for this, I think I’m getting closer now. The modesToUnsubscribe part isn’t giving me an error anymore thanks to the second one you sent me. But now I’m getting an input error with “key .unsubscribeContacts”. I’m guessing it’s the same problem as the first issue, but i’m not sure how to write this expression in studio to meet what the first screenshot is looking for. (Ignore the mismatching phone numbers)

Appreciate the help.

especially when new by working with JSON we recommend to check the raw view:
grafik

So what is needed to get constructed?

image

image

@ppr I got it to work!! I found another forum that basically said to add another quote wherever a quote exists. This will work if I want to just copy/paste that source data from the payload, but double up on my quotes in the body of the http request activity.

I appreciate the responses!

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