json:

{

"1" : "2",

"1" : "3"

}

在json中如果有重复的key,会取最后一个key的值,如上面的json,"1"的值为"3"

javascript array:

索引数组:var arr1 = [1,2]

关联数组:var arr2 = {1:2,1:3}

js的关联数组与json类似,重复的key只取最后一个key的值,上例中key1的值为3

注:json语法是javascript的子集,且json的key只能为string类型

JSON小记的更多相关文章

  1. JSON 小记

    JSON是在web应用中频繁使用的一种数据结构,在使用过程中经常出现格式错误等等问题,如果能清晰的了解JSON的构成,那将会避免这些错误 英文好的可以查看原文: 地址:http://www.codep ...

  2. Newtonsoft.Json小记

    /*json相关*/ //http://www.cnblogs.com/hongfei/p/3593936.html string jsonObject = "{\"phone\& ...

  3. 临时处理小记:把Numpy的narray二进制文件转换成json文件

    临时处理一个Numpy的二进制文件,分析知道里面是dict类型,简单小记一下,如果Numpy和Python基础不熟悉可以看我之前写的文章 In [1]: %%time import numpy as ...

  4. json学习小记

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  5. JavaScript中字符串转Json方法小记

    例如: JSON字符串:var str1 = '{ "name": "cxh", "sex": "man" }'; JS ...

  6. JavaScript对json操作小记

    JSON是一种轻量级的数据交换格式,同时,JSON是 JavaScript 原生格式,因此我们可以直接处理它不需要依赖任何工具包或者插件.因此,好多后台都会选择返回给前端这种非常友好的数据格式. 引子 ...

  7. (转)JavaScriptSerializer,DataContractJsonSerializer解析JSON字符串功能小记

    JsonAbout: using System;using System.Collections.Generic;using System.Linq;using System.Text;using S ...

  8. Json数组操作小记 及 JSON对象和字符串之间的相互转换

    [{"productid":"1","sortindex":"2"},{"productid":&q ...

  9. 小记SpringMVC与SpringBoot 的controller的返回json数据的不同

    近期由于项目的改动变更,在使用springmvc和springboot测试的时候发现一个有趣的现象 1.springmvc的controller使用@ResponseBody返回的仅仅是json格式的 ...

随机推荐

  1. js 数组的拼接

    数组的拼接 var a = [1,2,3,4,5,6]; var b=["foo","bar", "fun"]; 最终的结果是: [ 1,2 ...

  2. PTA 6-2 多项式求值

    PTA 6-2 多项式求值 本题要求实现一个函数 本题要求实现一个函数,计算阶数为n,系数为a[0] ... a[n]的多项式f(x)=∑i=0n(a[i]×xi)" role=" ...

  3. Python--day42--mysql创建用户及授权

    1,打开mysql数据库命令:mysql -u root -p 2,创建数据库create database db2; 2,删除数据库drop database db2; 2,展示有多少个文件夹:sh ...

  4. 2019-2-28-C#-16-进制字符串转-int-

    title author date CreateTime categories C# 16 进制字符串转 int lindexi 2019-02-28 11:51:36 +0800 2018-04-2 ...

  5. Linux 内核 PCI 总线

    任何在 PCI 总线上的设备有参数 name 和 SUBSYSTEM 环境变量设置为值 pci. PCI 子系 统也一直添加下面 4 个环境变量: PCI_CLASS 设备的 PCI 类号, 16 进 ...

  6. dotnet 特性 DynamicallyInvokable 是用来做什么的

    我在 Linq 很多函数都看到 __DynamicallyInvokable 这个特性,这是一个没有官方文档的特性,也许是用来优化反射 在堆栈 网找到了以下描述 这个 __DynamicallyInv ...

  7. You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

    异常 You are using the runtime-only build of Vue where the template compiler is not available. Either ...

  8. boostrap-非常好用但是容易让人忽略的地方【7】:list-unstyled list-inline

    无样式列表 list-unstyled:去掉ul的默认样式 内联列表 list-inline:将ul子元素放置于同一行

  9. Struts2 数据标签

    Struts 2 的数据标签主要用于操作页面上显示的数据.下面列出的是重要的数据标签: action标签: 此标记使开发人员能够直接从JSP页面调用动作指定动作的名称和一个可选的命名空间.标签的主体内 ...

  10. 019.MFC_两种对话框

    对话框分为模态和非模态对话框两种 模态对话框(Modal) d.DoModal() 必须关闭才能返回主窗口 非模态对话框(Modaless) p->Create(IDD_DIALOG,this) ...