可以用json中的json值填充当前对象吗? [英] It is possible to fill current object with json values from json?
本文介绍了可以用json中的json值填充当前对象吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用对象构造函数中的Json填充对象字段。
I would like to fill object fields with values from Json in object constructor.
public AbstractObject(String jsonSerializedObject) {
Gson gson = new Gson();
// Fill object values from json in *current* object
}
这可能吗?
推荐答案
Gson不支持填充现有对象(尚未)。请参阅此处的问题431.
Gson doesn't support "populating existing object" (yet). See issue 431 here.
http://code.google.com/p/google-gson/issues/detail?id=431&q=existing
这篇关于可以用json中的json值填充当前对象吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文