Fastjson: com.alibaba.fastjson.JSONException: create instance error, class com.vpgame.core.SteamTrade$TradeStatus

Created on 23 Oct 2013  ·  4Comments  ·  Source: alibaba/fastjson

{"newversion":true,"version":1,"me":{"assets":[],"currency":[],"ready":false},"them":{"assets":[],"currency":[],"ready":false}}

格式化这个json报错。

Most helpful comment

内嵌类需要是静态,否则无法创建

All 4 comments

内嵌类需要是静态,否则无法创建

I also have the com.alibaba.fastjson.JSONException: create instance error
with:Caused by: java.lang.NullPointerException
at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.createInstance(JavaBeanDeserializer.java:97)

and your chinese answer seems to be
"Embedded class needs to be static, or can not create" in english - you might want to translate your answer. Also you might want to change the behaviour from a NullPointerException to a message stating
"Class is not static ...". Better even you might want to warn about this when serializing.

@WolfgangFahl inner Class needs to be static,otherwise it can't be create.

@sonzhihui thanks for commenting. Your statement is a repetition of @wenshao 's statement of October 3 2014 in chinese. My comment is a change request about improving the Exception in adding excactly this explanation - better even avoiding the issue in the first place by already warning when serializing e.g. with a special check annotation for devlopers.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sd4324530 picture sd4324530  ·  3Comments

luckydzp picture luckydzp  ·  4Comments

ZYRzyr picture ZYRzyr  ·  3Comments

KeZhimin picture KeZhimin  ·  3Comments

cddesire picture cddesire  ·  3Comments