How to POST raw whole JSON in the body of a Retrofit request?

前端 未结 23 2941
面向向阳花
面向向阳花 2020-11-22 00:57

This question may have been asked before but no it was not definitively answered. How exactly does one post raw whole JSON inside the body of a Retrofit request?

See

23条回答
  •  猫巷女王i
    2020-11-22 01:49

    You can use hashmap if you don't want to create pojo class for every API call.

    HashMap hashMap=new HashMap<>();
            hashMap.put("email","this@gmail.com");
            hashMap.put("password","1234");
    

    And then send like this

    Call register(@Body HashMap registerApiPayload);
    

提交回复
热议问题