尝试使用LitJson从json字符串映射到对象时遇到问题。我不知道为什么这会引发错误。但是我的情况很简单。
我的课:
import Tab from '@material-ui/core/Tab'
================================================ =========================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LitJson;
public class return_jsons {
public int num_rows;
public int success;
public int transaction;
public string reason;
public string data;
public return_jsons(int Num_row, int Success, int Transaction, string Reason, string Data) {
this.num_rows = Num_row;
this.success = Success;
this.transaction = Transaction;
this.reason = Reason;
this.data = Data;
}
public return_jsons Clone() {
return new return_jsons (num_rows, success, transaction, reason, data);
}
public return_jsons () {
}
}
在这种情况下,我的代码行代码中的“ 43”行出现错误:
** rs = JsonMapper.ToObject(www.downloadHandler.text); **
错误是:
未找到方法:“未找到默认构造函数... System.String的ctor()”。
为什么会这样?
谢谢