Ask a Question

Using Property Transfer in Ready API, How Can I Transfer a Numeric Value into JSON object?

SOLVED
MFzOS
Occasional Contributor

Using Property Transfer in Ready API, How Can I Transfer a Numeric Value into JSON object?

Hi,

When fetching data source from EXCEL file, I need to transfer some of the values to JSON objects. All values are being parsed in as string format. How can I parse in values as integer instead when using property transfer step?

12 REPLIES 12
richie
Community Hero

Hey @MFzOS 

 

Ok - so I've set it up and it runs fine - when I first did it, it auto generated quote marks around the numeric values that ive parameterized in my payload, but once I'd removed them it works fine

 

 

have a look at the following screenshots:

 

richie_1-1649259930631.png

 

In the above screenshot you can see Im sourcing data from a csv using the Datasource (file) type.

The first two values auto generate alpha numeric values, but column 3 includes a numeric and column 4 includes a string 1.0 is wrapped in quotes

 

Next - if you look at the REST request in the screenshot below - in the Request tab and the payload editable field - you can see Im sourcing data from the Data Source test step.  

richie_2-1649260095169.png

if you look at the 'defraexp_ehcstatus' attribute value in the input payload above - the parameterized value is NOT wrapped in quotes (so it's numeric)

If you look at the 'defraexp_ehcversion' attribute value in the input payload above - the parameterized value IS wrapped in quotes (so it's a string)

 

Now - if you look at the next screenshot, you can see the RAW of the request - which shows what is submitted - in this case, the submitted payload maintained the attributes' datatypes relative to what was defined

 

richie_3-1649261129104.png

 

cool?

 

Cheers,

 

Rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
MFzOS
Occasional Contributor

Great! This is actually working. I just think it is a bit strange that when moving properties using Property Transfer or even entering values manually via Grid view it doesn't take the type of the attribute under consideration.

 

Many thanks for your help, Rich! 

 

Cheers! 

richie
Community Hero

Hey @MFzOS 

 

Yeah - is a bit weird - also - when I tried initially it inserted quote marks into my payload around the numerics automatically that I had to remove - even though there weren't any to begin with - that's not gonna help someone a little unfamiliar with the functionality - theyre just gonna struggle thinking it doesnt support numerics!

 

I might have a play around with the functionality to work out in the ins and outs of it - as i said in the original message - values are saved as strings - but with a json payload - it's whether you've included quote marks in your payload that determines whether it's a string or numeric.

 

Anyway - glad you got it sorted!

 

Rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
cancel
Showing results for 
Search instead for 
Did you mean: