Forum Discussion

atariqharri's avatar
atariqharri
Occasional Contributor
2 years ago

Parameterize Json Body of REST Request

Is there a way to quickly parameterize the nodes of a JSON request body? Rather than manually creating a data source and mapping each value with the corresponding JSON node, I want to generate a Data source step for my Request body automatically.

1 Reply

  • TNeuschwanger's avatar
    TNeuschwanger
    Champion Level 2

    Hello atariqharri 

     

    Since you said "automatically", that leads me to groovy scripting straight away...  🙂

     

    The way I would do that is to have a groovy script test step that builds a syntactically correct json string and write that to a properties test step.  Then within the JSON request test step, reference the single property value you saved from building it in the previous step.  Just a thought.  🙂

     

    Regards,

    Todd