8. js中json格式解析

Posted on 2016-08-03 10:29  zkx4213  阅读(146)  评论(0编辑  收藏  举报

var doc = O_PARAMETER.FJSonStr;(doc为:{"items":[],"nextId":0})

//1.先转为json对象,主要有以下三种转换方式

//var obj = eval('(' + doc+ ')');

//var obj = doc.parseJSON();
var obj = JSON.parse(doc);

 

//2.取对应的值
var items=obj.items;
var nextId=obj.nextId;

Copyright © 2024 zkx4213
Powered by .NET 9.0 on Kubernetes