How do I post a json array with retrofit2? For example,

Multi tool use


How do I post a json array with retrofit2? For example,
i have similar issue,
API require to send like this
checkpoin=[{"id":"1907","gps":"31213123,3131231","status":"1"}]
I successfully created:
[{"id":"1907","gps":"31213123,3131231","status":"1"}]
and retrofit configs are like this
@POST("save_clockings")Observable<ResponseSaveCehckpoint> saveChekpoint (
@Query(value = "checkpoint" ,encoded = true) List<JsonObject> checkpoint);
but i look with HTTP logging
URL like this
https://my.domain.com/api/save_clockings?checkpoint={%22id%22:%221907%22,%22gps%22:%2231213123,3131231%22,%22time%22:%221532674384157%22,%22status%22:%221%22}
i send via insomnia that's success,
enter image description here
why retrofit convert character (") to (%22);
can someone help me?
Thanks
link
– Mahavir Jain
10 mins ago
1 Answer
1
@POST("save_clockings") Observable<ResponseSaveCehckpoint> saveChekpoint(@Query(value = "checkpoint") List<JsonObject> checkpoint);
remove encoded = true
so it will not encode your "
to %22
encoded = true
"
%22
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
en.wikipedia.org/wiki/Percent-encoding
– 2Dee
13 mins ago