SalomonBrys / Kotson

Kotlin bindings for JSON manipulation via Gson
MIT License
709 stars 37 forks source link

Returning nullable types? #29

Open eddnav opened 7 years ago

eddnav commented 7 years ago

From the readme:

Attention: gson.fromJson will return a non-nullable type whereas gson.fromJson<MyType?> will return a nullable type. Therefore the code gson.fromJson("null") is correct and will throw a null-pointer exception!

But it is not possible to use MyType?, Kotlin says the following: Type argument not within its bounds, which it's expected since it's expecting Any, non-nullable.

sschuberth commented 7 years ago

Same here when trying to use val jsonObject = Gson().fromJson<JsonObject?>(jsonString).

dysan1376 commented 7 years ago

still waiting for an answer :(

reitzig commented 4 years ago

Same as #26?