Question

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?

  • 2 August 2022
  • 3 replies
  • 8 views

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?

3 replies

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.

Userlevel 3
Badge +7

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

Reply