Saving Dynamic JSON output in CSV in Columns

sushilsushil Posts: 5

hi is there any way to save complete dynamic JSON output in csv in columns . right now i used write file and saved in CSV but it is saving in one row.

my expectation is to save all json values in csv with 2 columns , field name and field value.

i cant use data bank because json file is dynamic, one file might have 10 field and other might have 100 .

thank you in advance


  • jakubiakjakubiak Posts: 723 admin

    There is no automatic way to do this with SOAtest. I would recommend you write your own script/code to parse the JSON and write out the CSV in the format you desire.

  • sushilsushil Posts: 5

    thank you,

    so to parse, do i need to use data bank to pull all values first or can i read JSON output with script ?

  • jakubiakjakubiak Posts: 723 admin

    You would create a script that you could reference using an Extension Tool. It might be easiest to write a JavaScript script and use the Oracle Nashorn engine in the Extension Tool, so that you can use the JSON.parse() method that JavaScript has to parse the JSON. Then you would simply need to walk the JSON parse tree that you get from JSON.parse() and construct the CSV content as a string, which you would then return from your script method. In SOAtest you could then attach a Write File tool to write the contents to disk.

  • sushilsushil Posts: 5

    Thq will try

Sign In or Register to comment.