简体   繁体   中英

Converting null object Gson to Json

I've been using Google's Gson API for quite some time and love its simplicity.

Nonetheless, I've found (probably) a bug on the toJson method.

When I try to convert a null object to JSON , instead of an exception, or alternatively a null String return, I get a String with the value null .

Do you consider this a bug?

null在转换时不会产生NullPointerException ,因为它是文字且有效的Gson值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM