如何在c#中创建json对象?

时间:2017-03-11 11:47:08

标签: c# asp.net json

我拥有来自aspx页面的所有值。现在我想通过从用户输入并希望以相同格式提交到其他应用程序的aspx的控制值中提取来准备以下json值。以下是我想要进行精确复制的示例,如下所示。

 var tempk = {
        "requestTypeCode": "PRE_DETERMINATION",
        "billingProvider": {
            "npi": "1234567893",
            "ein": "111222333",
            "payerAssignedProviderId": "XYZ321"
        },
        "patient": {
            "relationshipCode": "01",
            "lastName": "Smith",
            "firstName": "Bob",
            "stateCode": "FL",
            "birthDate": "1980-02-12",
            "genderCode": "M"
        },
        "payer": {
            "id": "BCBSF"
        },
        "submitter": {
            "id": "123456789",
            "lastName": "SUBMITTER"
        },
        "subscriber": {
            "memberId": "JDH001",
            "groupName": "ASDF 1-2",
            "groupNumber": "12312412"
        },
        "claimInformation": {
            "placeOfServiceCode": "11",
            "diagnoses": [
              {
                  "qualifierCode": "ABK",
                  "code": "J3089"
              }
            ],
            "serviceLines": [
              {
                  "procedureCode": "92523",
                  "quantity": "100",
                  "amount": "250",
                  "fromDate": "2016-05-10"
              }
            ]
        }
    }

你能帮我解决一下C#代码的实现方式吗?

1 个答案:

答案 0 :(得分:0)

您可以使用nuget

中的Newtonsoft.Json

http://www.newtonsoft.com/json