Debug what's returning -> Error required value missing at $
Asked Answered
V

0

6

So I usually have this typical error messages when using a new API

com.squareup.moshi.JsonDataException: Required value 'X' (JSON name 'x') missing at $
        at com.squareup.moshi.internal.Util.missingProperty(Util.java:649)
        at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapter.fromJson(KotlinJsonAdapter.kt:103)
        at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
        at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:46)
        at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:27)
        at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)
        at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:153)
        at okhttp3.RealCall$AsyncCall.run(RealCall.kt:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)

I'd like to know a way to debug exactly what's returning from this call. For example if it's missing the parameter "X" then I want to know if it's empty or if it's returning some data.

Already tried the logging interceptor but I think I didn't set it up properly. Any exact way to debug what's the exact data returning from this call?

Solution: I think using a Web debugger is the only way (Charles Proxy for example)

Vaas answered 11/9, 2021 at 11:25 Comment(1)
Why not install Postman or even try the Postman web version to send a @GET request and see the` JSON` Response. There is also a good video on Query and Path Parameters to get you started.Mitran

© 2022 - 2024 — McMap. All rights reserved.