向FromJson
的{{1}}方法发送参数时,
无法隐式转换类型。存在显式转换(您是 缺少演员表?)
发生错误。
我尝试更改参数类型,尝试强制转换类类型和修改后的类结构以遵循GoogleGson
,但均无济于事。以下是我正在使用的源代码:
Java.Lang.Object
下面是 HomePojo mHomePojo = null;
Gson mGson = new Gson();
try
{
JSONObject dataObject = jObject.GetJSONObject(AppGlobal.TAG_JSON_DATA_OBJECT);
com.greatlocations.pojos.HomePojo clazz = new com.greatlocations.pojos.HomePojo();
mHomePojo = mGson.FromJson(dataObject.ToString(), Java.Lang.Class.FromType(clazz.GetType()));
}
catch (JSONException e)
{
Console.WriteLine(e.ToString());
Console.Write(e.StackTrace);
}
类:
HomePojo
此行,
public class HomePojo : Java.Lang.Object
{
public string name;
public string latitude;
public string longitude;
public string imageUrl;
public string addsUrl;
public string thumbnailURL;
public string addsImage;
public string greetings;
public string description;
public int id;
java.util.ArrayList<>();
public List<Category> categories = new List<Category>();
java.util.ArrayList<>();
public List<AreaInfo> areaInfoArrayList = new List<AreaInfo>();
}
抛出错误
无法隐式转换类型。存在显式转换(您是 缺少演员表?)