Home > Web Front-end > Front-end Q&A > Is json equal to javascript?

Is json equal to javascript?

藏色散人
Release: 2021-10-14 15:24:43
Original
2863 people have browsed it

json is not javascript; json is a lightweight data exchange format, and javascript is a lightweight, interpreted or just-in-time compiled programming language with function priority; the json format is derived from JavaScript Object, which is a subset of JavaScript.

Is json equal to javascript?

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

Is json just javascript?

json is not javascript.

JSON (JavaScript Object Notation) is a lightweight data exchange format. JSON format data is mainly used for cross-platform exchange of data. JavaScript ("JS" for short) is a lightweight, interpreted or just-in-time compiled programming language with function priority.

But JSON and JavaScript do have origins. It can be said that this data format evolved from JavaScript objects and is a subset of JavaScript. JSON itself means JavaScript Object Notation, which uses strict JavaScript object notation to represent structured data.

It is a strict js object format. The attribute name of JSON must have double quotes. If the value is a string, it must also be double quotes;

JSON is just a data format (or data format), the data format is actually a specification. Format, form, and specification cannot be used to store data. We cannot call the following objects JSON, for example:

<script>
var obj2={};//这只是JS对象
var obj3={width:100,height:200};/*这跟JSON就更不沾边了,只是JS的 对象 */
var obj4={&#39;width&#39;:100,&#39;height&#39;:200};/*这跟JSON就更不沾边了,只是JS的对象 */
var obj5={"width":100,"height":200,"name":"rose"}; /*我们可以把这个称做:JSON格式的JavaScript对象 */
var str1=&#39;{"width":100,"height":200,"name":"rose"}&#39;;/*我们可以把这个称做:JSON格式的字符串 */
var a=[
                {"width":100,"height":200,"name":"rose"},
                {"width":100,"height":200,"name":"rose"},
                {"width":100,"height":200,"name":"rose"},
        ];
        /*这个叫JSON格式的数组,是JSON的稍复杂一点的形式 */
var str2=&#39;[&#39;+
                &#39;{"width":100,"height":200,"name":"rose"},&#39;+
                &#39;{"width":100,"height":200,"name":"rose"},&#39;+
                &#39;{"width":100,"height":200,"name":"rose"},&#39;+
        &#39;]&#39; ;
        /* 这个叫稍复杂一点的JSON格式的字符串 */
</script>
Copy after login

Is json equal to javascript?

Recommended learning: "javascript basic tutorial"

The above is the detailed content of Is json equal to javascript?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template