Forum Discussion

Pprado's avatar
Pprado
Occasional Contributor
3 years ago
Solved

The content you are trying to view cannot be viewed as JSON

hello! I am testing a JSON format, but the response is The content you are trying to view cannot be viewed as JSON

I already checked in JSON Formatter  if there was something wrong, but it is ok.

Thank you

Priscila

  • The response payload contains HTML, not JSON.

    That's why you cannot see it in the JSON tab.

     

    If you get a JSON response, the JSON tab will be active.

     

    Karel

  • richie's avatar
    richie
    3 years ago

    Hey Pprado 

     

    you "might" be able to force the issue if your app server allows the change.

     

    If you add an 'Accept' header to your request (that returns your html response) and the value of the 'Accept' header set as 'application/json'

     

    Adding the Accept header into a request to force a specific datatype in the response has worked for me before.  Although it all depends on if your app server will allow this.

     

    Cheers,

     

    Rich

  • Hi Pprado !

    Just click the 'Accept as Solution' button next to the correct reply in this thread:

10 Replies

  • KarelHusa's avatar
    KarelHusa
    Champion Level 3

    Hi Pprado ,

    it seems SoapUI cannot parse the response as a JSON message.

    Can you include the content of the Raw tab to see what's wrong?

     

     

    Regards,

    Karel

     

    • Pprado's avatar
      Pprado
      Occasional Contributor

      hello!

      thank you for your attention to my request.

       

      please see below the RAW response

       

      HTTP/1.1 404 Not Found
      Connection: keep-alive
      X-Powered-By: Undertow/1
      Server: WildFly/10
      Content-Length: 74
      Content-Type: text/html
      Date: Wed, 05 Jan 2022 16:45:21 GMT

      <html><head><title>Error</title></head><body>404 - Not Found</body></html>

      • KarelHusa's avatar
        KarelHusa
        Champion Level 3

        The response payload contains HTML, not JSON.

        That's why you cannot see it in the JSON tab.

         

        If you get a JSON response, the JSON tab will be active.

         

        Karel