0
j個の息子データをどのように扱うのですか?私は最後の更新時間をデータテーブルに取得できません。番号の形式のJsonデータの処理
データテーブルに、数字ではなく文字列であるデータを取得できるようにしました。これを解決するにはどうすればいいですか?ここに私のコードとありがとうたくさんあります。
{
"response": [
{
"location": "44994f77-e633-4d82-847c-1ccbb01e9ec4",
"type": "Manager",
"serialNumber": "FOC1537W1ZY",
"family": "John",
"lastUpdateTime": 1476263348659,
"siblings": null,
"children": "",
"hiredate": "2016-04-13 02:56:25",
"medicalStatus": "clear",
"age": "55",
}
],
"version": "1.0"
}
public class Response
{
public string location { get; set; }
public string type { get; set; }
public string serialNumber { get; set; }
public string family { get; set; }
public object lastUpdateTime { get; set; }
public object siblings { get; set; }
public string children { get; set; }
public string hireDate{ get; set; }
public string age{ get; set; }
}
public class RootObject
{
public List<Response> response { get; set; }
public string version { get; set; }
}
DataTable dtPromotions = new DataTable();
dtPromotions.Columns.Add("location", typeof(string));
dtPromotions.Columns.Add("type", typeof(string));
dtPromotions.Columns.Add("serialNumber", typeof(string));
dtPromotions.Columns.Add("family", typeof(string));
dtPromotions.Columns.Add("lastUpdatedTime", typeof(string));
dtPromotions.Columns.Add("siblings", typeof(string));
dtPromotions.Columns.Add("children", typeof(string));
dtPromotions.Columns.Add("hireDate", typeof(string));
dtPromotions.Columns.Add("age", typeof(string));
foreach (var off in hostdata2)
{
string off1 = Convert.ToString(off);
string[] RowData = Regex.Split(off1.Replace
("{", "").Replace("}", ""), ",");
DataRow nr = dtPromotions.NewRow();
foreach (string rowData in RowData)
{
try
{
int idx = rowData.IndexOf(":");
string RowColumns = rowData.Substring
(0, idx - 1).Replace("\"", "").Trim();
string RowDataString = rowData.Substring
(idx + 1).Replace("\"", "");
nr[RowColumns] = RowDataString;
}
catch (Exception ex)
{
ex.Message.ToString();
continue;
}
}
dtPromotions.Rows.Add(nr);
}
RadGrid1.DataSource = dtPromotions;
RadGrid1.DataBind();
ありがとうございますが、データベースにアクセスできないため、日付に変更する方法がありません。 APIの場所を指定しています。データテーブルに移入する必要があります。上記の例を与えられた日付に私はどのようにそれを隠すべきですか?ありがとうたくさん –
データ()メソッドを使用してください! –