功能:给定文件Json是:Request Body 给定json请求数据
{
"Body" :{
"SomeText": "12001BC851B3605EA",
}
}
响应机构Json将是:
{
"Body" : {
"NewText": "12001BC851B3605EA",
}
}
想要使用Javascript将Key“SomeText”与其值比使用新键“NewText”进行比较。
答案 0 :(得分:0)
了解如何比较两个json
对象
var rs1 = {
"Body" :{
"SomeText": "12001BC851B3605EA",
}
}
var rs2 = {
"Body" : {
"NewText": "12001BC851B3605EA",
}
}
$(document).ready(function () {
if (rs1.Body.SomeText == rs2.Body.NewText) {
alert("true")
// Do something
} else {
alert("false")
// Do something
}
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
&#13;