简体   繁体   English

我的JSON数组会是什么样子?

[英]What will my JSON array look like?

I am making a ajax call, and the backend is gonig to return a JSON array. 我正在进行ajax调用,后端是gonig以返回JSON数组。

Can someone give me an example of what my json array should look like so I can do the following in javascript? 有人可以给我一个我的json数组看起来如何的示例,以便我可以在javascript中执行以下操作吗?

if(myJSON.ErrorCode == 100)
{        
    alert(myJSON.Response.Message);

    for(var x = 0; x < myJSON.Response.Values.Count; x++)
             alert(myJSON.Response.Values[x];
}
else
{
       if(myJSON.ErrorCode == 250)
       {

           alert(myJSON.ErrorMessage);
       }

}

First case: 第一种情况:

{ ErrorCode: 100, Response: { Message : "some message", Values : [0, 1, 2, ... ] } }

Second case: 第二种情况:

{ ErrorCode: 250, ErrorMessage: "error message" }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WCF REST:我希望我的XML在请求中看起来像什么? - WCF REST: What is it expecting my XML to look like in requests? 在IIS中托管时,我的MVC Core应用程序的Program类应该是什么样? - What should my MVC Core app's Program class look like for hosting in IIS? 在这两个JSON对象中是否存在差异,看起来好像没有,但是 - Is there diference in this two JSON objects, look like there is no, but 在ASP.NET中,这种经典的ASP代码是什么样的? - What would this Classic asp code look like in asp.net? 在线写入文本文件,Web路径是什么样的? - Write to text file online, What does the web path look like? 为什么我的 asp.net 项目看起来像引用未解析? - why my asp.net project look like references not resolved? 看起来像我的MVC网站中的查询字符串参数长度问题 - look like Query string parameter length issue in my MVC website 试图做JSON.parse,但它不喜欢我从我的服务器返回的字符串做什么 - Trying to do JSON.parse but it doesnt like what i am doing with a returned string from my server 我的 javascript 必须如何在我的 ASP.NET 页面末尾运行 - how must my javascript look like to run at the end of my ASP.NET page 使用Json ATTRIBUTE序列化日期时间,使其在C#中看起来像/ Date(1486516302715) - using Json ATTRIBUTE to serialize datetime to look like /Date(1486516302715) in C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM