JavaScriptSerializer标记数组对象

时间:2019-03-18 19:56:41

标签: .net javascriptserializer

我正在查看一些继承的代码,这些代码使用JavaScriptSerializer序列化对象。它产生的基本格式是:

{
"Procedures": [
    {
        "ProcedureCode": "01234",
        "ProcedureCost": "968.00"
    },
    {
        "ProcedureCode": "02345",
        "ProcedureCost": "259.00"
    }
]
"Errors": [
    {
        "ErrorCode": "e1",
        "ErrorMessage": "error one"
    },
    {
        "ErrorCode": "e2",
        "ErrorMessage": "error two"
    }
]

}

但是我需要做的是格式化它:

{
"Procedures": [
    {
        "Procedure":
        {
            "ProcedureCode": "01234",
            "ProcedureCost": "968.00"
        }
    },
    {
        "Procedure":
        {
            "ProcedureCode": "02345",
            "ProcedureCost": "259.00"
        }
    }
]
"Errors": [
    {
        "Error":
        {
            "ErrorCode": "e1",
            "ErrorMessage": "error one"
        }
    },
    {
        "Error":
        {
            "ErrorCode": "e2",
            "ErrorMessage": "error two"
        }
    }
]

}

我试图寻找解决方案,但没有提出任何建议。

0 个答案:

没有答案