Forum Discussion
2 Replies
Sort By
- LoundesMContributor
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
- nmraoChampion Level 3It would be good if you can show the data that you are working with and what data do you need to extract.
Related Content
- 6 years agopankajmalinda
- 7 years agoKate
- 11 months agoakilan
- 7 years agomoolickj