为了账号安全,请及时绑定邮箱和手机立即绑定

用JavaBean添加GSON显示错误

https://img1.sycdn.imooc.com//5c3abcf300019a2a19201048.jpg

用JsonObject是正常的,用Gson就会显示这个

{serializeNulls:falsefactories:[Factory[typeHierarchy=com.google.gson.JsonElement,adapter=com.google.gson.internal.bind.TypeAdapters$25@67424e82], com.google.gson.internal.bind.ObjectTypeAdapter$1@42110406, com.google.gson.internal.Excluder@531d72ca, Factory[type=java.lang.String,adapter=com.google.gson.internal.bind.TypeAdapters$13@22d8cfe0], Factory[type=java.lang.Integer+int,adapter=com.google.gson.internal.bind.TypeAdapters$7@579bb367], Factory[type=java.lang.Boolean+boolean,adapter=com.google.gson.internal.bind.TypeAdapters$3@1de0aca6], Factory[type=java.lang.Byte+byte,adapter=com.google.gson.internal.bind.TypeAdapters$5@255316f2], Factory[type=java.lang.Short+short,adapter=com.google.gson.internal.bind.TypeAdapters$6@41906a77], Factory[type=java.lang.Long+long,adapter=com.google.gson.internal.bind.TypeAdapters$8@4b9af9a9], Factory[type=java.lang.Double+double,adapter=com.google.gson.Gson$3@5387f9e0], Factory[type=java.lang.Float+float,adapter=com.google.gson.Gson$4@6e5e91e4], Factory[type=java.lang.Number,adapter=com.google.gson.internal.bind.TypeAdapters$11@2cdf8d8a], Factory[type=java.lang.Character+char,adapter=com.google.gson.internal.bind.TypeAdapters$12@30946e09], Factory[type=java.lang.StringBuilder,adapter=com.google.gson.internal.bind.TypeAdapters$16@5cb0d902], Factory[type=java.lang.StringBuffer,adapter=com.google.gson.internal.bind.TypeAdapters$17@46fbb2c1], Factory[type=java.math.BigDecimal,adapter=com.google.gson.internal.bind.TypeAdapters$14@1698c449], Factory[type=java.math.BigInteger,adapter=com.google.gson.internal.bind.TypeAdapters$15@5ef04b5], Factory[type=java.net.URL,adapter=com.google.gson.internal.bind.TypeAdapters$18@5f4da5c3], Factory[type=java.net.URI,adapter=com.google.gson.internal.bind.TypeAdapters$19@443b7951], Factory[type=java.util.UUID,adapter=com.google.gson.internal.bind.TypeAdapters$21@14514713], Factory[type=java.util.Locale,adapter=com.google.gson.internal.bind.TypeAdapters$24@69663380], Factory[typeHierarchy=java.net.InetAddress,adapter=com.google.gson.internal.bind.TypeAdapters$20@5b37e0d2], Factory[type=java.util.BitSet,adapter=com.google.gson.internal.bind.TypeAdapters$2@4459eb14], com.google.gson.internal.bind.DateTypeAdapter$1@5a2e4553, Factory[type=java.util.Calendar+java.util.GregorianCalendar,adapter=com.google.gson.internal.bind.TypeAdapters$23@28c97a5], com.google.gson.internal.bind.TimeTypeAdapter$1@6659c656, com.google.gson.internal.bind.SqlDateTypeAdapter$1@6d5380c2, com.google.gson.internal.bind.TypeAdapters$22@45ff54e6, com.google.gson.internal.bind.ArrayTypeAdapter$1@2328c243, Factory[type=java.lang.Class,adapter=com.google.gson.internal.bind.TypeAdapters$1@bebdb06], com.google.gson.internal.bind.CollectionTypeAdapterFactory@7a4f0f29, com.google.gson.internal.bind.MapTypeAdapterFactory@45283ce2, com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory@2077d4de, com.google.gson.internal.bind.TypeAdapters$26@7591083d, com.google.gson.internal.bind.ReflectiveTypeAdapterFactory@77a567e1],instanceCreators:{}}


正在回答

1 回答

明白了, gson本身不能直接打印

打印的是gson.toJson()的返回值

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

用JavaBean添加GSON显示错误

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信