Answered question

JSON Variable Extractors

Hello,

I want to be able to extract some variables in the POST Parameters that is passed in JSON format. Here is an example.

{"updatedObject":{"OrderID":4992988,"CarrierID":3155,"CarrierName":"(*P)Atlas Motor Express, Inc.","oldValue":null,"OldCarrierName":null}}

I want to be able to extract the OrderID and insert a new OrderID via SQL Database. However when I go to variable extractor, All the Test Tab returns is True. I've tried every combination there is but still am unable to get it to Extract the OrderID.

If you have any info or have experience this in the past and have a solution please let me know,

Regards

Donny D.
Donny D.

Donny D.

Level
0
34 / 100
points
Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

If the value that you would like to use is not coming from a server response then it's not a variable extractor that you should use.

In your case, you just need to replace the OrderID value by your variable name directly on the POST request in the design section.

Before:

{"updatedObject":{"OrderID":4992988,"CarrierID":3155,"CarrierName":"(*P)Atlas Motor Express, Inc.","oldValue":null,"OldCarrierName":null}}

After:

{"updatedObject":{"OrderID":${MyVariable},"CarrierID":3155,"CarrierName":"(*P)Atlas Motor Express, Inc.","oldValue":null,"OldCarrierName":null}}

Here your variable name is "MyVariable" and based on your SQL statement or CSV file.

Does it make sense to you?

Did you find this useful ?

No (0)

Yes (1)

100%

100% of users found this answer useful

Other answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

I do not understand one thing. You say "All the Test Tab returns is True". What do you mean by that?

Could you provide a screen shot?

Do you really want to extract this OrderID from a server response? Or just replace it in a POST request by a value coming from a SQL statement probably made with an advanced SQL action?

Could you clarify a bit?

Donny D.
Donny D.

Donny D.

Level
0
34 / 100
points

Yes, I am trying to extract the OrderID in order to replace it with another OrderID using a SQL connection or CSV File. Here is the file where the Test tab only returns true but it doesn't return the extracted variable.