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

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


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





en.wikipedia.org/wiki/Percent-encoding
– 2Dee
13 mins ago





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.

pcbMjq08mD5r17YPt1u9 isxfcT3 jG rgSLIt6HvYIMZ,M1OFKa,pq2Shm jr,7cFF768Nqhk kbyNixjddF78ci9
cvizS,xhkER,1LdhMadzPNGWBH42W,T2wQWkMh,yK,i,Q,zxDkDu Hio g4WAvkKj

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Regex - How to capture all iterations of a repeating pattern?