• 技术文章 >Web开发 >JavaScript

    js中的JSON是什么

    小妮浅浅小妮浅浅2021-06-19 16:53:56原创3719

    使用说明

    1、JSON是JS的对象,也是数据形式。采用完全独立于语言的文本格式,是理想的数据交换格式。

    2、JSON是JavaScript原生格式。

    JSON中的两个api

    将JSON字符串转换为JSON对象JSON.parse()

    将JSON对象转换为JSON字符串JSON.stringify()

    实例

    使用Object.prototype.toString获得对象的类型。

    var toString = Object.prototype.toString;
     
    toString.call(new Date); // [object Date]
    toString.call(new String); // [object String]
    toString.call(Math); // [object Math]
    toString.call(/s/); // [object RegExp]
    toString.call([]); // [object Array]
     
    //Since JavaScript 1.8.5
    toString.call(undefined); // [object Undefined]
    toString.call(null); // [object Null]

    以上就是js中的JSON的介绍,希望对大家有所帮助。更多js学习指路:js教程

    推荐操作环境:windows7系统、jquery3.2.1版本,DELL G3电脑。

    专题推荐:js json
    品易云
    上一篇:js引擎是什么意思 下一篇:js中this的使用场景

    相关文章推荐

    • php解析json数据• php返回json数据• Python字典和json的比较• php数组转json字符串• python json保存数据的方法• python json文件格式转换• java中jstack是什么• js中reduce在数组的使用• js单例模式如何理解• js策略模式是什么?• js代理模式怎么用?• js中介者模式是什么意思?• js中介者模式的使用场景• js装饰者模式是什么

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网