我正在尝试序列化这个内部类
static class functionMessage{
String type = "function";
String id;
String function;
Object parameters;
public functionMessage(String ID, String Function, Boolean Parameters) {
this.id = ID;
this.function = Function;
this.parameters = (Boolean) Parameters;
}
}
和
new flexjson.JSONSerializer().exclude("*.class").serialize(
new functionMessage(
"container",
"showContainer",
Boolean.TRUE
)
)
但只是{}
被退回。
如果我尝试public
在每个成员变量之前添加,则会出现此错误:
flexjson.JSONException: Error trying to deepSerialize
Caused by: java.lang.IllegalAccessException: Class flexjson.BeanProperty can not access a member of class with modifiers "public"
我尝试按照示例进行操作,但它没有显示如何Person
构造,并且我不知道将类static
设为内部类会如何影响这一点,因为我对 Java 还是很陌生。
我还尝试阅读 Google 针对该错误提供的所有解决方案,但仍然一无所获。
如何返回一个内部类flexjson.JSONSerializer()
的所有成员变量?static