Skip to main content
Hi team, I am trying to send a post REST call and have figured out how to paramaterize all my data in the JSON. However it appears like AA360 will not let me pass a value as a number, only a string? Has anyone run into this issue before?

To clarify if I just type a number into the JSON like this

 

"PartnerAppId": 777,

 

it works fine but when trying to parameterize it by doing

 

   "PartnerAppId": $PartnerAppIdNum$,

 

It does not work. I queried that data out of a JSON using the JSON object manager package which turns it into a string "777" but now I can't seem to be able to turn it back into a number?


Hey @Ashwin A.K​ thanks for the reply.

 

I think you are correct in that for some reason it just can't be done which is kind of a shame. I can't change the API JSON parser in this case so I have to send it as a number. I just re-approached this by refactoring how I was accessing the JSON data and ended up dumping the entire JSON into a data table and then just passing that data table cell to the body as a variable and that worked fine.

 

Thanks again for the help.


Hi @Ray GIbson​ ,

 

If you are trying to convert a string to number, you can either use the String: To Number Action or you can use an Inline Operation simply by add a period(.) right before the last dollar sign and invoking intellisense to draw out string:ToNumber.

 

 

If you were trying to add a number to the JSON body, you can't add numbers into a string field unless you convert it into a string - which defeats the purpose of declaring it as a number variable in the first place.

 

I guess what you could do, is develop the JSON body in such a way that JSON recognizes it as a number.

 

We know key-value pairs of type string are always enclosed with quotations:

 

{

"access_token" :"yAbAaBaDo"

}

 

And numbers are declared without the quotations:

 

{

"limit": 10

}

 

I'm not entirely sure if this is what you were looking for, but I hope it works(and helps).

 

Kind Regards,

Ashwin A.K


Hi Ashwin,

I have a JSON formatted data as below, this is parsing to Rest API - POST method:

 {
          "name": "Project Name:",
          "value": "Test"
  }

Now I have created a variable i.e. string type. $Project_Name$ = API Test

I used as below:

{
          "name": "Project Name:",
          "value":  $Project_Name$
  }

 

Getting Below Error:

---------------------------

 

 


Reply