Tool: Online jsonviewer

JSON: JavaScript Object Notation.

JSON is a syntax for storing and exchanging data.

JSON Objects

JSON objects are written inside curly braces.

{"name":"John", "age":25, "japanese":false}

JSON Arrays

JSON arrays are written inside square brackets.

"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter","lastName":"Jones"}
]

JSON Uses JavaScript Syntax

var employees = [
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter","lastName": "Jones"}
];

Be accessed:

// returns John Doe
employees[0].firstName + " " + employees[0].lastName; // returns John Doe
employees[0]["firstName"] + " " + employees[0]["lastName"];

Be modified

employees[0].firstName = "Gilbert";

employees[0]["firstName"] = "Gilbert";

Object From String: Create a JavaScript string containing JSON syntax

var text = '{ "employees" : [' +
'{ "firstName":"John" , "lastName":"Doe" },' +
'{ "firstName":"Anna" , "lastName":"Smith" },' +
'{ "firstName":"Peter" , "lastName":"Jones" } ]}';

The JavaScript function JSON.parse(text) can be used to convert a JSON text into a JavaScript object:

// Normal browsers
var obj = JSON.parse(text);
// Older browsers
var obj = eval ("(" + text + ")");
// Output
obj.employees[1].firstName + " " + obj.employees[1].lastName

以上です。

Array JSON的更多相关文章

  1. Ajax Array Json 示例

    function functionName(){ var list=new Array(); $("td.classA").each(function(){ list.push($ ...

  2. 从零开始——JSON ARRAY&JSON OBJECT

    在学习“基于角色的权限”的例子中,遇到了json object和json array,因此在一番学习之后对此要点进行粗略整理. 参考: https://my.oschina.net/u/2601842 ...

  3. 数据处理 array json 格式 转换成 数组形式

    处理这种数据应该使用的方式是 this.cities= res.data.data.cities.sort((a,b)=>{ //排序 进行字母排序 return a.pinyin[0].cha ...

  4. 【转换】Bean、List、Map、Array、String与JSON字符串的相互转换

    import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.math.BigDecimal; i ...

  5. 不一样的dynamic解析json 万能方法

    写过javascript的人都知道js解析json 1:(JSON) 字符串转换为对象. var str = '{"name":"lsw","hobb ...

  6. Android 图文数据JSON解析,金山词霸每日一句API的调用

    金山词霸开发的免费API http://open.iciba.com/dsapi/ 数据格式为 {","name":"\u7535\u5f71\u7ecf\u5 ...

  7. 构造Json对象串工具类

    import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.Property ...

  8. Android 图文数据JSON解析

    数据格式为 {"sid":"737","tts":"http:\/\/news.iciba.com\/admin\/tts\/20 ...

  9. alibaba的FastJson(高性能JSON开发包),fastjson 使用demo

    这是关于FastJson的一个使用Demo,在Java环境下验证的 class User{ private int id; private String name; public int getId( ...

随机推荐

  1. 中国电信某站点JBOSS任意文件上传漏洞

    1.目标站点 http://125.69.112.239/login.jsp 2.简单测试 发现是jboss,HEAD请求头绕过失败,猜测弱口令失败,发现没有删除 http://125.69.112. ...

  2. iOS网络相关零散知识总结

    iOS网络相关零散知识总结 1. URL和HTTP知识 (1) URL的全称是Uniform Resource Locator(统一资源定位符). URL的基本格式 = 协议://主机地址/路径   ...

  3. jsp上传excel文件并导入数据库

    1,excel文件的上传 需要借助jar包:commons-fileupload-1.2.1.jar以及commons-io-1.3.2.jar 前端的html文件 <form id=" ...

  4. windows下使用pthreads

    pthread-win32在Windows上实现了线程相关的Posix标准,接口一模一样 包含: thread mutex cond swlock spin sem barrier https://s ...

  5. log4j2.x 配置文件默认寻找顺序

    Automatic Configuration Log4j has the ability to automatically configure itself during initializatio ...

  6. Tomcat Nginx cluster note

    nginx install 需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩. 5.安装nginx Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来 ...

  7. LinkedHashMap 和 LRU算法实现

    个人觉得LinkedHashMap 存在的意义就是为了实现 LRU 算法. public class LinkedHashMap<K,V> extends HashMap<K,V&g ...

  8. MJRefresh简单处理

    //下拉刷新 默认 self.bottomTableVeiw.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ [self he ...

  9. ads 调试

    1.路径错误,中文名称 2.定义错误

  10. Leetcode: Kth Smallest Element in a Sorted Matrix

    Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth ...