Forum Discussion

infitude's avatar
infitude
New Contributor
10 years ago

Property Transfer using JSONPath in 5.1.2

Hi,

 

Is there some guidance on using the JSONPath path language in Property Transfers with version 5.1.2?  It's great that we can now use this feature for testing our JSON based services but I'm a bit stuck trying to figure out the correct syntax.  Google has not been my friend in this case...

 

Thanks in advance fort any help...

4 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Can you please post more details so that some can understand what you are trying to achieve. An example would be helpful.
    • infitude's avatar
      infitude
      New Contributor

      Hi, sure, I'm using SoapUI 5.1.2 and have a REST GET request (REQUEST1) that returns JSON which I have validated using jsonlint.com.  In a testsuite I create a new testcase with 2 test requests and a Property Transfer.  In the property transfer I set the source and target to the two testcase requests.  In the source, I set the property to 'Response' and the path language to 'JSONPath'.  In the target I set the property to Request and the path language to JSONPath.  Now, Im using http://goessner.net/articles/JsonPath/ for the syntax for JSONPath and have $.* in my source expression, which I think should be everthing in the response.  Now, when I run the property transfer I get "[Invalid JSON: { .... " in the transferred values.  Now, I'm assuming I have the syntax in the source expression wrong but I'm not sure.

      Interestingly, and I'm not sure if this is important or not, the JSON shown in the JSON tab is 'not the same' as in the Raw tab (the "class" object is missing)...

       

      Screen Shot 2015-03-19 at 2.52.57 pm.pngScreen Shot 2015-03-19 at 2.52.57 pm.png

       

      • infitude's avatar
        infitude
        New Contributor

        Hi, just to follow up on my previous post and state what I'm are trying to achieve;  I have a REST web service method that returns a JSON response.  I would like to extact a value from the body of the repsonse and pass it to another REST web service method that takes the value in the URL.  How would I do this in SoapUI 5.1.2?

         

        Simplified Example  (not related to the screen shots in the previous post)

        ------------------------

        First web service method;

         

        GET /customers

         

        {"customers": [

            {

             "firstName": "John",

             "lastName": "Smith",

             "customerId": "12345"

             }

        ]}

         

        >> extract customerId from JSON response, then >>>>

         

        second web service method with customerId 

         

        GET /customer/12345