Closed yoavst closed 8 years ago
Unfortuately, that's not true as Gson().fromJson<Whatever>("null") == null
.
So fromJson
does returns null when given the String "null".
I think it should be based on null ability of the generic parameter
What do you mean ?
In my code, I use `!!
immediately after every fromJson
. If I would like it to be nullable, I would use Whatever?
.
I see your point.
v1.7.0 corrects this
Needs simple sample of using Kotson. This does not work `import com.github.salomonbrys.kotson. import com.google.gson.
fun main (args: Array
}
val person=Gson().fromJson(obj,Person ::class.java)
}`
Since
Gson.fromJson
return null only if string is null, it can return not a nullable type.