Forum Discussion

sakshi's avatar
sakshi
New Contributor
13 years ago

XPath for JSON Request Body Parameters

How to write XPath for Request body parameters?? For example, I have Given id and name in request body like
{
"Id":1234,
"Name":"ABC"
}

and the response returns the same JSON format with additional parameters. I want to add a XPath assertion to "Name", dynamically.
Choosing:
${RequestName:#RawRequest}; returns complete JSON Request body:
{
"Id":1234,
"Name":"ABC"
} but I need XPath for "Name" only. How to write XPath/XQuery for it??

1 Reply

  • D1R3W0LF's avatar
    D1R3W0LF
    New Contributor
    Parse the JSON content using Slurper and use the elements as required.

    Cheers,
    D!r3w0LF