October 23, 2024
Chicago 12, Melborne City, USA
Android

Broken encoding in the received Json Android Retrofit2


Could you suggest any solutions to the problem? Upon request, I received the following message:

Unexpected JSON token at offset 0: Expected start of the array '[', but had '' instead at path: $JSON input: ~����������t������t5��������)����s�?��v���������sJ0d�%���|x��3ސ�4�z�r

My Retrofit builder looks like this:

Retrofit.Builder()
    .baseUrl(BASE_URL_API)
    .addConverterFactory(json.asConverterFactory("application/json; charset=UTF8".toMediaType()))
    .addCallAdapterFactory(ApiResponseCallAdapterFactory.create())
    .build()

When you try to access the URL through the browser, the data is displayed correctly, as well as there are no problems with other requests. What could be the problem?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video