Ask a Question

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

SOLVED
Pprado
Occasional Contributor

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

10 REPLIES 10
KarelHusa
Regular Contributor

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?

 

KarelHusa_0-1641391218413.png

 

Regards,

Karel

 

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
Regular Contributor

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

Pprado
Occasional Contributor

thank  you!

how can i fix  to get a JSON response?

All the best

Priscila

KarelHusa
Regular Contributor

Hi @Pprado ,

there may be different reasons, but most probable is you have incorrect URL for your test step.

 

If you are starting with REST API testing, I recommend:

 

Best regards,

Karel

 

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

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Pprado
Occasional Contributor

thank you for your help

 The content in the Endpoint field was incorrect.

The developer helped to  adjust that and it worked

Thank you

Priscila 

Pprado
Occasional Contributor

Thank you for your help

 The content in the Endpoint field was incorrect.

The developer helped to  adjust that and it worked

Thank you

Priscila 

Pprado
Occasional Contributor

hello! how could I mark as solved? 

cancel
Showing results for 
Search instead for 
Did you mean: