http://www.codeproject.com/Articles/779303/JSON-and-Microsoft-technologies

http://www.codeproject.com/Tips/885448/Google-Map-with-JSON

http://stackoverflow.com/questions/14927258/using-json-to-add-markers-to-google-maps-api

http://www.cnblogs.com/gawking/p/3544588.html

json:

{ "justIn": [
{ "textId": "123", "text": "Hello,geovindu", "textType": "Greeting" },
{ "textId": "514", "text":"What's up?", "textType": "Question" },
{ "textId": "122", "text":"Come over here", "textType": "Order" }
],
"recent": [
{ "textId": "1255", "text": "Hello,sibodu", "textType": "Greeting" },
{ "textId": "6564", "text":"What's up?", "textType": "Question" },
{ "textId": "0192", "text":"Come over here", "textType": "Order" }
],
"old": [
{ "textId": "5213", "text": "Hello,geovindu", "textType": "Greeting" },
{ "textId": "9758", "text":"What's up?", "textType": "Question" },
{ "textId": "7655", "text":"Come over here", "textType": "Order" }
]
}

  

<script src="Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript"> $(document).ready(function () {
$("#Link").click(function () {
$.ajax({
type: "GET",
url: "jsonfile/5.json",
dataType: "json",
success: function (data) {
$.each(data, function (k, v) {
$("#mapinfo").append(k + ', ' + "<br/><hr/>");
$.each(v, function (k1, v1) {
//$("#title").append(k);
$("#info").append(k1 + ' ' + v1.textId + ' ' + v1.text + ' ' + v1.textType + "</div><hr/>");
});
});
//
} });
return false;
});
});
</script>
</head>
<body>
<input type="button" id="Link" value="query"/>
<div id="title"></div>
<div id="content"></div>
<div id="mapinfo"></div>
<div id="info"></div>
</body>
</html>

  json:

{
"district": [
{
"did": "1",
"name": "武昌区",
"communitys": {
"community": [
{
"cid": "21",
"name": "安顺家园",
"url": "asjy",
"address": "武昌区中北路23号",
"x": "114.33830023",
"y": "30.55309607",
"img": "com21.png",
"hot": "0",
"groupbuy": "0",
"estates": {
"estate": [
{
"name": "竹居",
"value": "Z"
},
{
"name": "梅岭",
"value": "M"
},
{
"name": "兰亭",
"value": "L"
},
{
"name": "菊坊",
"value": "J"
}
]
}
},
{
"cid": "25",
"name": "百瑞景中央生活区",
"url": "brj",
"address": "武昌武珞路586号",
"x": "114.33729172",
"y": "30.52570714",
"img": "com25.png",
"hot": "0",
"groupbuy": "0",
"estates": {
"estate": [
{
"name": "南一区",
"value": "S"
},
{
"name": "北一区",
"value": "N"
},
{
"name": "东二区",
"value": "E"
},
{
"name": "西二区",
"value": "W"
}
]
}
},

  

    <title>json jquery 遍历json对象 数组</title>
<script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#button').click(function () {
$.ajax({
type: "GET",
url: "jsonfile/4.json",
dataType: "json",
success: function (data) {
//10个区:
var ll = data.district.length;
//1.
$.each(data.district, function (i, v) {
if (v.did == 1) {
$("#title").append(v.name);
return;
}
});
//2.
$.each(data.district, function (si, sv) {
//$("#content").append(si + ' ' + sv + "</div><hr/>");
$.each(sv, function (k1, v1) {
//$("#mapinfo").append(k1 + ', ' + v1 + "</div><hr/>");
if (k1 == "communitys") {
$.each(v1, function (ii, qname) {
if (ii == "community") {
$.each(qname, function (q, qqname) {
if (qqname.cid == 21) {
$("#result").append("地址2:" + qqname.address);
//alert(qqname.address);
return;
}
});
}
});
}
}); });
//3.第一个区
for (var i = 0; i < ll; i++) {
$.each(data.district[i].communitys, function (csi, csv) {
//$("#result").append("communitys object:" + csi + ' ' + csv + "</div><hr/>");
if (csi == "community") {
$.each(csv, function (iq, iqqname) {
if (iqqname.cid == 51) {
$("#info").append("地址3:" + iqqname.address);
//alert(qqname.address);
return;
}
});
} });
}
//$("#content").append(l);
//4.0第一个区第一条记录
for (var i = 0; i < ll; i++) {
$.each(data.district[i].communitys.community, function (msi, msv) {
$.each(msv, function (du, geovin) {
$("#content").append(du + ' ' + geovin + "</div><hr/>");
// if (geovin.cid == 21) {
//$("#content").append("地址4:" + geovin.address);
//return;
// } });
});
} } });
return false; });
});
</script>
</head>
<body>
<div>点击按钮获取JSON数据</div>
<input type="button" id="button" value="确定" />
<div id="title"></div>
<div id="content"></div>
<div id="mapinfo"></div>
<div id="result"></div>
<div id="info"></div>
</body>
</html>

  

<title>json jquery 遍历json对象 数组 geovindu</title>
<script src="Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript"> ///对象语法JSON数据格式(当服务器端回调回来的对象数据格式是json数据格式,必须保证JSON的格式要求,回调的对象必须使用eval函数进行转化(否则将得不到Object)。本文不作详细介绍服务器端回调的数据问题,我们将直接自定义对象)
$(document).ready(function () {
$('#button').click(function () {
$.ajax({
type: "GET",
url: "jsonfile/4.json",
dataType: "json",
success: function (data) {
//var obj = eval(data.district);
$(data.district).each(function (index, value) {
// var val = obj[index];
$("#title").append(index);
$.each(value, function (k1, v1) { $("#content").append(k1 + ' ' + v1 + "</div><hr/>");
if (k1 == "communitys") {
$.each(v1, function (q1, qname) {
$("#mapinfo").append(q1 + ' ' + qname + "</div><hr/>");
if (q1 == "community") {
$.each(qname, function (t1, tname) {
$("#result").append(t1 + ', ' + tname.cid +tname.name+tname.address+tname.x+tname.y+tname.img+ "</div><hr/>");
});
}
});
} });
}); }
});
return false;
});
});
</script> </head>
<body>
<div>点击按钮获取JSON数据</div>
<input type="button" id="button" value="确定" />
<div id="title"></div>
<div id="content"></div>
<div id="mapinfo"></div>
<div id="result"></div>
<div id="info"></div>
</body>
</html>

  How to select json item from the array

<title>json jquery 遍历解析json对象 How to select json item from the array</title>
<script src="Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
//http://stackoverflow.com/questions/6107039/how-to-select-json-item-from-the-array
//http://stackoverflow.com/questions/4992383/use-jquerys-find-on-json-object var JSON = {
"infos": {
"info": [
{
"startYear": "1900",
"endYear": "1930",
"timeZoneDesc": "geovindu..",
"timeZoneID": "1",
"note": {
"notes": [
{
"id": "1",
"title": "Mmm"},
{
"id": "2",
"title": "Wmm"},
{
"id": "3",
"title": "Smm"}
]
},
"links": [
{
"id": "1",
"title": "Red House",
"url": "http://infopedia.nl.sg/articles/SIP_611_2004-12-24.html"},
{
"id": "2",
"title": "Joo Chiat",
"url": "http://www.the-inncrowd.com/joochiat.htm"},
{
"id": "3",
"title": "Bake",
"url": "https://thelongnwindingroad.wordpress.com/tag/red-house-bakery"}
]}
]
}
}; var infoLength= JSON.infos.info.length; for (infoIndex = 0; infoIndex < infoLength; infoIndex++) { var notesLength= JSON.infos.info[infoIndex].note.notes.length; for (noteIndex = 0; noteIndex < notesLength; noteIndex++) { alert(JSON.infos.info[infoIndex].note.notes[noteIndex].title); }
}
</script>

  查找参考:

//http://jsonselect.org/#tryit
//http://goessner.net/articles/JsonPath/
//https://github.com/lloyd/JSONSelect

http://www.codeproject.com/Tips/172224/Selecting-JSON-Objects

json:

[{ "TEST1": 45, "TEST2": 23, "TEST3": "DATA1" }, { "TEST1": 46, "TEST2": 24,
"TEST3": "DATA1" }, { "TEST1": 47, "TEST2": 25, "TEST3": "DATA3"}];

  

function sql(s) {
var returnObj = new Array();
var cntr = 0;
var cnt;
for (var bb = 0; bb < s.from.length; bb++)
{
//$.each(s.from, function(bb) {
var ifConditions = new Array();
for (cnt = 0; cnt < s.where.length; cnt++) {
ifConditions[cnt] = new Object();
var where = "";
if (s.where[cnt].OPERATOR.indexOf("=") == 0)
where = "==";
if (s.where[cnt].VALUE.indexOf("'") > -1)
ifConditions[cnt] = eval("'" + eval("s.from[bb]." + (eval("s.where[" + cnt + "].KEY"))) + "'" + where + eval("s.where[" + cnt + "].VALUE"));
else
ifConditions[cnt] = eval(eval("s.from[bb]." + (eval("s.where[" + cnt + "].KEY"))) + where + eval("s.where[" + cnt + "].VALUE"));
}
var comparedOutput = true;
for (cnt = 0; cnt < s.conditions.length; cnt++) {
var condition = "";
switch (s.conditions[cnt].CONDITION.toUpperCase()) {
case "AND":
condition = "&&";
break;
case "OR":
condition = "||";
break;
}
comparedOutput = comparedOutput && eval("ifConditions[" + s.conditions[cnt].Condition1 + "]" + condition + "ifConditions[" + s.conditions[cnt].Condition2 + "]");
}
if (comparedOutput) {
var result = {};
var cols = s.select.split(",");
for (var cnt = 0; cnt < cols.length; cnt++) {
result[cols[cnt]] = eval("s.from[bb]." + cols[cnt]);
}
returnObj.push(result);
}
}
return returnObj;
}

  

function sql(s) {
var returnObj = new Array();
var cntr = 0;
$.each(s.from, function(bb) {
var ifConditions = new Array();
$.each(s.where, function(cnt) {
ifConditions[cnt] = new Object();
var where = "";
if (s.where[cnt].OPERATOR.indexOf("=") == 0)
where = "==";
if (s.where[cnt].VALUE.indexOf("'") > -1)
ifConditions[cnt] = eval("'" + eval("s.from[bb]." + (eval("s.where[" + cnt + "].KEY"))) + "'" + where + eval("s.where[" + cnt + "].VALUE"));
else
ifConditions[cnt] = eval(eval("s.from[bb]." + (eval("s.where[" + cnt + "].KEY"))) + where + eval("s.where[" + cnt + "].VALUE"));
});
var comparedOutput = true;
$.each(s.conditions, function(cnt) {
var condition = "";
switch (s.conditions[cnt].CONDITION.toUpperCase()) {
case "AND":
condition = "&&";
break;
case "OR":
condition = "||";
break;
}
comparedOutput = comparedOutput && eval("ifConditions[" + s.conditions[cnt].Condition1 + "]" + condition + "ifConditions[" + s.conditions[cnt].Condition2 + "]");
});
if (comparedOutput) {
var result = {};
var cols = s.select.split(",");
for (var cnt = 0; cnt < cols.length; cnt++) {
result[cols[cnt]] = eval("s.from[bb]." + cols[cnt]);
}
returnObj.push(result);
}
});
return returnObj;
}

  TEST1 = 45 OR TEST3 = ‘DATA1’

var selectedObjs = sql({
select: "TEST1,TEST2",
from: a,
where: [{ "KEY": "TEST1", "OPERATOR": "=", "VALUE": "45" }, { "KEY": "TEST3", "OPERATOR": "=", "VALUE": "'DATA1'"}],
conditions: [{ "Condition1": "0", "CONDITION": "Or", "Condition2": "1"}]
});

  

ttp://techslides.com/how-to-parse-and-search-json-in-javascript
http://goessner.net/articles/JsonPath/

http://stackoverflow.com/questions/5288833/how-to-search-json-tree-with-jquery
https://github.com/dragonworx/jsel

http://stackoverflow.com/questions/6107039/how-to-select-json-item-from-the-array

http://techslides.com/how-to-parse-and-search-json-in-javascript

https://gist.github.com/iwek/3924925

javascript: Jquery each loop with json array or object的更多相关文章

  1. Poco::JSON::Array 中object 设置preserveInsertionOrder 时,stringify出错-->深入解析

    在使用poco version 1.6.0时 Poco::JSON::Array 在object  设置preserveInsertionOrder =true 时 调用 array.stringif ...

  2. 不要将 Array、Object 等类型指定给 prototype

    在 JavaScript 中,注意不要将 Array.Object 等类型指定给 prototype,除非您的应用需要那么做.先观察如下代码: function Foo(){}Foo.prototyp ...

  3. 使用Javascript/jQuery将javascript对象转换为json格式数据 - 海涛的CSDN博客 - 博客频道 - CSDN.NET

    body{ font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI& ...

  4. Javascript/jQuery关于JSON或数组集合的几种循环方法

    JavaScript遍历JSON或数组集合: /** * 根据json数据生成option树形控件 * 如果有children节点则自动生成树形数据 * @param {JSON} data * @p ...

  5. Web前端学习笔记之JavaScript、jQuery、AJAX、JSON的区别

    官网的英文解释: javascript和jQuery有点关系,js是一种脚本语言,主要用于客户端,现在主要用于实现一些网页效果. jquery是js的一个库,你可以认为是对js的补充,提供了很多方便易 ...

  6. Loop through an array in JavaScript

    https://stackoverflow.com/questions/3010840/loop-through-an-array-in-javascript?page=1&tab=votes ...

  7. JavaScript jQuery 中定义数组与操作及jquery数组操作

    首先给大家介绍javascript jquery中定义数组与操作的相关知识,具体内容如下所示: 1.认识数组 数组就是某类数据的集合,数据类型可以是整型.字符串.甚至是对象Javascript不支持多 ...

  8. javascript: jquery.gomap-1.3.3.js

    from:http://www.pittss.lv/jquery/gomap/solutions.php jquery.gomap-1.3.3.js: /** * jQuery goMap * * @ ...

  9. (转)springMVC框架下JQuery传递并解析Json数据

    springMVC框架下JQuery传递并解析Json数据 json作为一种轻量级的数据交换格式,在前后台数据交换中占据着非常重要的地位.Json的语法非常简单,采用的是键值对表示形式.JSON 可以 ...

随机推荐

  1. DRUPAL 慢的原因

    不止一次听人抱怨DRUPAL 慢,在本地开发环境尤为常见,较为常见的原因有:- 本地环境造成慢的原因,最常见的是由update manager  造成的,如果你发现你开的DRUPAL 页面 一直在等待 ...

  2. 深圳测试研讨会圆满结束,PPT共享

    深圳测试研讨会圆满结束,PPT共享http://www.automationqa.com/forum.php?mod=viewthread&tid=3417&fromuid=29

  3. [转]ASP.NET页面之间传递值的几种方式

    页面传值是学习asp.net初期都会面临的一个问题,总的来说有页面传值.存储对象传值.ajax.类.model.表单等.但是一般来说,常用的较简单有QueryString,Session,Cookie ...

  4. sql:pivot unpivot

    pivot  行转列 unpivot  列转行 源码跑步起来 这是能跑起来的 源码转自 http://www.cnblogs.com/zhangzt/archive/2010/07/29/178782 ...

  5. ora-01031:insufficient privileges解决方法 - 转

    今天晚上要远程修改一个分公司的数据库参数,于是下午先远程过去做些准备工作.数据库是oracle 11g rac,操作系统是windows 2008 server,我还是第一次见过windows下的or ...

  6. 2dtoolkit获取sprite像素大小的方法

    获取sprite像素的方法 Vector2 GetPixelSize(tk2dSpriteDefinition def){ ].x; ].y; // Calculate dimensions in p ...

  7. IL速查

    名称 说明 Add 将两个值相加并将结果推送到计算堆栈上. Add.Ovf 将两个整数相加,执行溢出检查,并且将结果推送到计算堆栈上. Add.Ovf.Un 将两个无符号整数值相加,执行溢出检查,并且 ...

  8. mysql 显示行号,以及分组排序

    建表: CREATE TABLE `my_tb` ( `id` ) NOT NULL AUTO_INCREMENT, `parent_code` ) DEFAULT NULL, `code` ) DE ...

  9. 【问题与思考】1+"1"=?

    概述 在数学中1+1=2,在程序中1+1=2,而1+"1"=? 围绕着1+"1"的问题,我们来思考下这个问题. 目录: 一.在.Net代码中 二.在JavaSc ...

  10. ionic 添加应用图标与启动页

    由于手机有很多不同的尺寸与版本,所以图标尺寸也是大小不一,但是如果手动每一个尺寸都制作一个图标,那估计美工会吐血吧,不过幸好,ionic只需要一个图标就可以制作不同尺寸的图标. 添加一个ionic项目 ...