デシリアライズした後、JSON文字列を出力に戻す際に問題が発生しています。JSONをOutputBufferに戻す
私はjson2csharpから生成した以下の3つのクラスを宣言しています。
public class Application
{
public int App_ID { get; set; }
public string App_Ref { get; set; }
public string Status { get; set; }
public string Error_Code { get; set; }
public string Error_Message { get; set; }
public string Create_Dt { get; set; }
public string Modify_Dt { get; set; }
public string Client_Name { get; set; }
public string Client_Code { get; set; }
public string Centrelink_Status { get; set; }
}
public class Response
{
public List<Application> Applications { get; set; }
public string Current_Dt { get; set; }
public string Last_App_Dt { get; set; }
public int Count { get; set; }
public int Total { get; set; }
}
public class RootObject
{
public bool Success { get; set; }
public Response jsonResponse { get; set; }
}
JSONレスポンスは次のようになります。
{
"Success": true,
"Response": {
"Applications": [
{
"App_ID": 2877582,
"App_Ref": "Odonnell",
"Status": "Complete",
"Error_Code": 0,
"Error_Message": "",
"Create_Dt": "2016-10-09 19:28:18.867 +00:00",
"Modify_Dt": "2016-10-09 19:33:10.810 +00:00",
"Client_Name": "Aussie Bike Auto & Boat Loans South",
"Client_Code": "GGT31",
"Centrelink_Status": "Receiving_Logons"
},
{
"App_ID": 2878070,
"App_Ref": "alliso",
"Status": "Quicklink",
"Error_Code": null,
"Error_Message": null,
"Create_Dt": "2016-10-09 21:55:49.220 +00:00",
"Modify_Dt": "2016-10-09 21:55:49.220 +00:00",
"Client_Name": "KChristoforidis",
"Client_Code": "GGT05",
"Centrelink_Status": "Receiving_Logons"
}...
],
"Current_Dt": "2016-11-13 22:52:41.581 +00:00",
"Last_App_Dt": "2016-10-11 01:42:25.470 +00:00",
"Count": 65,
"Total": 65
}
}
私はレスポンスから「成功」BOOL出力することが可能ですが、私は「オブジェクト参照がオブジェクトのインスタンスに設定されていません取得していますように私は、応答から何かを取り戻すことができません。 "私は次のことを試してみるとエラーが発生します。
foreach (Application app in outPutResponse.jsonResponse.Applications)
{
ApplicationBuffer.AddRow();
ApplicationBuffer.AppID = app.App_ID;
ApplicationBuffer.AppRef = app.App_Ref;
ApplicationBuffer.Status = app.Status;
}
私もと出力バッファへの対応「jsonResponse」を返すカント
「暗黙的BlobColumnにjsonResponseを変換することはできません」私はまた、次のエラーでoutPutResponse.jsonResponseからの応答値を返すことはできません。 '[]チャー' に 'Script.Response' へ変換することができない。
RawBuffer.AddRow();
RawBuffer.ResponseSuccess = outPutResponse.Success;
RawBuffer.Response.AddBlobData(Encoding.ASCII.GetBytes(outPutResponse.jsonResponse));
ための最良のオーバーロードされたメソッドが一致 'System.Text.Encoding.GetBytes(charは[])' 引数1は、いくつかの無効な引数を有する
これは私の最終的な障害であり、この権利を得ることはできないようです。誰も助けることができますか?前もって感謝します。
あなたはこれを今までにどれだけ高く評価しているのか分かりません。 –
@LucasPerrettようこそ – Jim