Forum Discussion

debrabph's avatar
debrabph
Occasional Contributor
6 years ago

SoapUI 5.4.0 XML tab don't display JSON content like 5.0.0

With the 5.0.0 version, when I receive a JSON response, I can show it in the XML tab. It's important for me because one json propertie of the message include an HTML content. So I can copy and past this content easily in a text editor.

 

With the 5.4.0 version, the json response in displayed in the json tab solely. In the XML tab there's the message "The content you are trying to view cannot be viewed as XML".

 

Can I reproduce the 5.0.0 behavior with the 5.4.0 version ?

  • Olga_T's avatar
    Olga_T
    6 years ago

    Sorry for the misunderstanding, I thought you were using the Pro version as this is the forum for SoapUI Pro. Have you asked this question in the SoapUI OS forum?

    (I have edited the reply because the link was wrong the first time, now it is correct, sorry for the confusion)

  • royki's avatar
    royki
    Occasional Contributor

    You can copy from the json tab as well. Do you want to copy the xml tags also ? As from the json tab the html code also appears.
    PS: Not sure did I get your requirement exactly or not.

    • debrabph's avatar
      debrabph
      Occasional Contributor

      Yes I can copy from the JSON tab, but the html code must be manually modified before it can be displayed by a navigator : remove \r, change \" with ", etc...

      From the XML tab (in 5.0.0) the HTML code is directly usable. See the joined files in my question.

      • richie's avatar
        richie
        Community Hero
        Hey

        If you manually need to remove/alter \r, etc. Using the RequestFilter.afterRequest event handler


        You can use something like the following code to alter '\r' to blank using the following code

        Def content = context.httpResponse.responseContent
        Log.info(content)
        content = content.replaceAll ("/\r", "")

        The above will remove '\r' in the response before displaying thr resultant content in your response tabs. You could reproduce the above for all the characters you need to alter.

        I've used the above approach before now when i had an html string in an escaped .json response and i had to verify and extract certain attribute values from thr html string.

        OR, If you just want to force your .json response into .xml (so it displays correctly in your outline tab) you could add the Accept header to your request that setting the value as 'application/xml', this will result in your response being returned as .xml in your response.

        Perhaps the above options can help?
        Cheers,

        Rich