随笔分类 -  Json

摘要:最近项目中总是调来调去的接口,理解不深甚是糊涂,遂简单整理一下也方便今后查用。【字符串转换为对象】parse用于从一个字符串中解析出json对象,如var str = '{"name":"demo","age":"22"}'结果:JSON.parse(str)Objectage:"22"name:"... 阅读全文
posted @ 2015-08-28 18:51 Demo金 阅读(621) 评论(0) 推荐(0)
摘要:【判断json是否为空】var jsonStr ={};1、判断json是否为空jQuery.isEmptyObject();2、判断对象是否为空:1、if (typeof(x) == "undefined")2、if (typeof(x) != "object")3、if(!x)其中第三种是最简单... 阅读全文
posted @ 2015-08-27 13:33 Demo金 阅读(8325) 评论(2) 推荐(1)