如果下面有json对象...如何访问字符串“Passwords must have ...”。

ModelState中的“”属性名称名称使我感到困惑。

谢谢!

{
    "Message": "The request is invalid.",
    "ModelState": {
        "": [
            "Passwords must have at least one non letter or digit character. Passwords must have at least one uppercase ('A'-'Z')."
        ]
    }
}

最佳答案

var a={
    "Message": "The request is invalid.",
"ModelState": {
    "": [
        "Passwords must have at least one non letter or digit character. Passwords must have at least one uppercase ('A'-'Z')."
    ]
}
};
console.log(a.ModelState[""]);

javascript - 使用空属性名称解析javascript中的json对象-LMLPHP

09-19 18:57