0

JSON のエクスポートを可能にする Draw2D ライブラリを使用していますが、それを実行しようとすると、MVC にエクスポートできません。これは Draw2D の問題ではなく、それを機能させる方法についての知識が不足しています。以下のようなJSONを生成します

    [
    {
        "type": "DBTable",
        "id": "662b1fb8-5eb8-47a5-9f81-e48efb0d31bd",
        "x": 80,
        "y": 59,
        "width": 99,
        "height": 107,
        "cssClass": "DBTable",
        "bgColor": "#DBDDDE",
        "color": "#D7D7D7",
        "stroke": 1,
        "alpha": 1,
        "radius": 3,
        "name": "Default AutoAttendant",
        "entities": [
            {
                "text": "0",
                "id": "0c4c5414-1f35-4247-a4b7-38297aa0e5ff"
            },
            {
                "text": "1",
                "id": "706e1cb7-a9d1-461d-8230-0bf136c1d850"
            }
        ]
    },
    {
        "type": "NamedUser",
        "name": "Scott",
        "id": "0d2c71cf-52ee-4c50-a974-ea07003df05e",
        "cssClass": "NamedUser",
        "bgColor": "#DBDDDE",
        "color": "#D7D7D7",
        "stroke": 1,
        "alpha": 1,
        "radius": 3,
        "x": 220,
        "y": 200
    },
    {
        "type": "NamedUser",
        "name": "Nancy",
        "id": "601b0ad9-a0e9-4604-8861-38694a43e0a8",
        "cssClass": "NamedUser",
        "bgColor": "#DBDDDE",
        "color": "#D7D7D7",
        "stroke": 1,
        "alpha": 1,
        "radius": 3,
        "x": 220,
        "y": 200
    }
]

私のコントローラーは、潜在的な副作用の問題をすべて取り除くために、現時点では非常に基本的なものです。

public ActionResult Draw2dRetrieveJSON(AllJson AllJsontxt)
    {

私のクラスは次のようになります

public class AllJson
{
   public  IEnumerable<HostedVoiceUserJson> HostedVoiceUserJson { get; set; }
   //public IEnumerable<HostedVoiceHuntGroupJson> HostedVoiceHuntGroupJson { get; set; }
   //public IEnumerable<HostedVoiceAAJson> HostedVoiceAAJson { get; set; }
   //public IEnumerable<HostedVoiceConnectionJSON> HostedVoiceConnectionJSON { get; set; }
}

この投稿に従って、「NamedUser」オブジェクトを自分で投稿し、JSON文字列を一致するように手動で変更しました

{
                "HostedVoiceUserJson": [
                    {
                        "type": "NamedUser",
                        "name": "Scott",
                        "id": "0d2c71cf-52ee-4c50-a974-ea07003df05e",
                        "cssClass": "NamedUser",
                        "bgColor": "#DBDDDE",
                        "color": "#D7D7D7",
                        "stroke": 1,
                        "alpha": 1,
                        "radius": 3,
                        "x": 220,
                        "y": 200
                    },
                    {
                        "type": "NamedUser",
                        "name": "Nancy",
                        "id": "601b0ad9-a0e9-4604-8861-38694a43e0a8",
                        "cssClass": "NamedUser",
                        "bgColor": "#DBDDDE",
                        "color": "#D7D7D7",
                        "stroke": 1,
                        "alpha": 1,
                        "radius": 3,
                        "x": 220,
                        "y": 200
                    }
                ]
            }

もちろん、私はここに座ってこれらを手動で変更することはできません。これを機能させるために離れて見つけて、複数の異なるタイプをまとめて投稿できるようにする必要があります。

4

1 に答える 1