Created
August 12, 2020 07:10
-
-
Save shihabmi7/899cb63b6a4fafb644de33eef2be4c0d to your computer and use it in GitHub Desktop.
Sent Plain JSON as String with Moshi & Retrofit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
want to sent plain json as post request, with retrofit and moshi converter ??? | |
{"id":1,"firstName":"Lokesh","lastName":"Gupta","roles":["ADMIN","MANAGER"]} | |
Retrofit.Builder() | |
.client(client) | |
.baseUrl(baseUrl) | |
.addConverterFactory(ScalarsConverterFactory.create()) // you need to add this for sending plain json object | |
.addConverterFactory(MoshiConverterFactory.create(moshi)) | |
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) | |
.build() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment