Forum Discussion
LoundesM
8 years agoContributor
Hi
have a look at this http://docs.groovy-lang.org/latest/html/gapi/groovy/json/JsonSlurper.html
you will probably use something like this to get your json payload
def slurper = new JsonSlurper() def result = slurper.parseText(mockRequest.getRequestContent())
use an example from the link above to see how to get specific values
within your dispatch script set a property value to hold the respective json element value
context.setProperty( "PropertyName", JSONElementValue)
then within your response simply use ${PropertyName} where you want your inbound value to be returned
i.e.
{ "Request value" : "${PropertyName}" }
obviously using a naming convention that suits
hope that helps
Related Content
- 6 years agopankajmalinda
- 7 years agoKate
- 7 years agomoolickj
- 11 months agoakilan