标签:
JSON.parse
JSON.stringify
<script type="text/javascript">
(function($){
var obj = {
"title":"jsonparse",
"time":new Date().getTime()
};
var arr = [{"title":"jsonarr"},{"time":new Date().getTime()}];
console.log(typeof(obj));
console.log($.isArray(obj));
console.log($.isPlainObject(obj));
console.log(JSON.stringify(obj));
var str = JSON.stringify(obj);
console.log("json parse:" + JSON.parse(str));
console.log(typeof(arr));
console.log($.isArray(arr));
console.log($.isPlainObject(arr));
console.log(JSON.stringify(arr));
var strarr = JSON.stringify(arr);
console.log("json parse:" + JSON.parse(strarr));
})(jQuery);
</script>
标签:
原文地址:http://www.cnblogs.com/yubolin/p/5207762.html