cancel
Showing results for 
Search instead for 
Did you mean: 

Using a File datasource to read a file full of JSON (and then to use that JSON with a JSON datasourc

Highlighted
Occasional Contributor

Re: Using a File datasource to read a file full of JSON (and then to use that JSON with a JSON datas

Hi Anton,

Thanks very much for your answer, we are following your suggestions.

 

Now, we found a problem executing the second Transfer, the value is changed correctly, but now all the JSON null values, somehow, during the transfer are all switched over to { }. Can we keep it with null like the original request?, otherwise we are getting Err in Our Response.

 

Thanks very much

anna

Highlighted
Staff

Re: Using a File datasource to read a file full of JSON (and then to use that JSON with a JSON datas

Hi, Anna,

 

Ready! API parses JSON to make a property transfer to the position specified in JSON path and then regenerates string representation with a changed field - I think that's when it replaces null with {}. It seems like a bug in our JSON library, or the library might need some extra configuration. I'll create an issue for that and see what we can do.


Anton Egorov
ReadyAPI developer
Highlighted
Occasional Contributor

Re: Using a File datasource to read a file full of JSON (and then to use that JSON with a JSON datas

Hi Anton,

 

Any update related to the issue?.
Any other way to replace parameters?.
With this issue we can not work very much with automation

 

Thanks very much
Anna

Highlighted
Staff

Re: Using a File datasource to read a file full of JSON (and then to use that JSON with a JSON datas

Hi Anna

 

The issue isn't fixed yet. I can suggest a simple workaround though - using Groovy script to replace {} with "null" values. You should add a Groovy test step right after Property Transfer with the following script (assuming POST Request is your request with corrupted null fields):

 

import com.eviware.soapui.model.testsuite.TestStep
String request = context.expand( '${POST Request#Request}' )
String correctedRequest = request.replace("{}", "null")
TestStep testStep = testRunner.getTestCase().getTestStepByName("POST Request")
testStep.setPropertyValue("Request", correctedRequest)

Hope it helps.

 

 


Anton Egorov
ReadyAPI developer
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Check out this week's challenge!

Create a script to generate an email when an assertion fails for the TechCorner tag!


Scripts created in July:
- A script to change the request body before sending it to the server