Ask a Question

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

SOLVED
eissaeva
Contributor

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

Hi

I am not able to view response in JSON

ReadyAPI 3.8.0

 

Screen Shot 2021-07-16 at 10.17.10 AM.png

 

The tool shows views for all other formats successfully

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
nmrao
Community Hero

Re: The content you are trying to view cannot be viewed as JSON in ReadyAPI

You need to report to your team and get it addressed if the services are developed by your team.


Regards,
Rao.

View solution in original post

5 REPLIES 5
richie
Community Hero

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

Hey @eissaeva,

Can you confirm the Content-Type header of the response please?

This will indicate the supported datatype of the response.

Ta

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

Re: The content you are trying to view cannot be viewed as JSON in ReadyAPI

The content type of the response header is text/plain

richie
Community Hero

Re: The content you are trying to view cannot be viewed as JSON in ReadyAPI

Hey @eissaeva,

Yep...."text/plain" Content-Type header value results in the payload being ignored by ReadyAPI's/SoapUI's json or xml parsers, which makes asserting on thr content awkward.

If youre expecting the response to be wellformed Json or xml this sounds like a sloppy defect for dev to fix.

However, depending on the app server endpoint youre hitting you can alter the datatype of the response by doing the following:

Add an Accept HTTP header to the request which generates the json response thats comimg back with the text/plain Content-Type header. Ensure the value of the Accept header is either text/json or application/json (try both, one or even both might not work....depends on what your endpoint supports) Resubmit the request, view and check the results. Whats the Content-Type of the response? Do you now get content in the json response tab?

This has worked numerous times for me when i had the same problem. It very rarely didnt work due to a restriction on the endpoint.

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

Re: The content you are trying to view cannot be viewed as JSON in ReadyAPI

tried with both - the value of the Accept header is either text/json or application/json  - did not work

nmrao
Community Hero

Re: The content you are trying to view cannot be viewed as JSON in ReadyAPI

You need to report to your team and get it addressed if the services are developed by your team.


Regards,
Rao.

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: