Skip to content

Jsoup Fix Connection error: org.jsoup.UnsupportedMimeTypeException

This example shows how to fix the Jsoup Connection error: org.jsoup.UnsupportedMimeTypeException error while using the Jsoup.

How to fix Connection error: org.jsoup.UnsupportedMimeTypeException?

By default, Jsoup supports below given content types.
1) text/*
2) application/xml
3) application/xml+xhtml

If you try to parse any page whose content type is not one of the above content types, Jsoup throws “Connection error: org.jsoup.UnsupportedMimeTypeException” exception as given below.


I have used the JSON test API hosted at which gives the user’s IP address in JSON format. The content type returned by the API is “application/json” which is not supported by Jsoup by default, hence the exception “org.jsoup.UnsupportedMimeTypeException: Unhandled content type”.

How to resolve this exception?

We can use ignoreContentType method of the Connection class to ignore the content type returned by the webpage.

Passing true in the ignoreContentType method ignores the document’s content type while parsing the response.



If you want to learn more about HTML parsing using Jsoup, please visit the Jsoup tutorial with examples.

Please let me know your views in the comments section below.

About the author


Leave a Reply

Your email address will not be published.