Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty Json Body #1

Closed
kelvindu opened this issue May 18, 2017 · 5 comments
Closed

Empty Json Body #1

kelvindu opened this issue May 18, 2017 · 5 comments

Comments

@kelvindu
Copy link

kelvindu commented May 18, 2017

Mas untuk menghandle json yang kosong di RxOkhttp kayak gimana ya? error yang saya hadapi sama dengan yang di bahas di sini : square/retrofit#1554, tapi di situ solusinya adalah menggunakan rxjava2 dan retrofit2.

request json yang saya hadapi kurang lebih seperti ini:
{
"data" : "",
"id": 1
}
saya tidak perlu menyimpan "data" tetapi karena nilainya yg kosong membuat saya tidak bisa mengconvert satu json tsbt menjadi gson.

Thank you

@isfaaghyth
Copy link
Owner

bisa diterapkan AdapterFactory ini:
http://chrisjenx.com/gson-empty-json-to-null/

@isfaaghyth
Copy link
Owner

kasusnya seperti ini:
{
"data" : "",
"id": 1
}
atau ini:
{
"data" : null,
"id": 1
}
??

@kelvindu
Copy link
Author

yg pertama mas, tapi sudah resolved hehe. saya berhasil implemen ke retrofit jadinya. tapi skrg jadi ada isu baru mas.

jadi recyclerview nya mencoba nge bind datanya sebelum masuk, makanya jadi ga ke tampil apa".
saya kepikiran mau di caching tapi masih experimen sih pake yg mana yg mudah hehehe

@kelvindu
Copy link
Author

udh resolved mas, saya close ya hehe

@isfaaghyth
Copy link
Owner

wah, ok.
maaf, baru ada kabar lagi.
macbook ku kemarin ngga bisa nyala hehe.
sipsip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants