JSON stands for JavaScript Object Notation, basically, JSON is often used with JavaScript and it was originally a subset of the JavaScript programming language. However, JSON is a language-independent data format. In this article, we will learn about JSON and its interesting facts through examples.
JSON Introduction
When data can be transmitted and stored in a simple format, it's called JSON, or JavaScript Object Notation. Arrays, objects, name and value pairs, and other data types can all be found in JSON. This format uses quotation marks, square brackets, parentheses, semicolons, and colons as punctuation marks. In JSON, data is represented as name-value pairs, much like JavaScript object properties. JSON is a lightweight data transmission method. Furthermore, this language is described as prototype-based, multi-paradigm, and dynamic. Whenever data is sent from the server to a web page, we need to use JSON.
JSON Facts
Here we will discuss many interesting facts about JSON with explanations and examples. Here are interesting facts about JSON -
Originally, JSON was considered a subset of the JavaScript programming language. (Specifically the standard ECMA-262, third edition published in December 1999).
JSON is generated by JavaScript, and many programming languages now have code that can be used to call and interpret JSON formatted data. It is a data format that is not language specific. The accepted JSON internet media type is application/JSON. The .json extension is used for JSON file names.
Douglas Crockford was the first to define and popularize the JSON format. In April 2001, Douglas Crockford and Chip Morningstar sent the first JSON message.
Crockford inserted a phrase into the JSON license stating that "this software should be used for good, not evil." On the other hand, since free software and open source software usually mean no restrictions on the purpose of use, this part leads to licensing compatibility issues of the JSON license with other open source licenses.
The syntax of the JSON format is comparable to the syntax of JavaScript object creation code. This allows JavaScript programs to easily convert JSON data into JavaScript objects. JSON data can be used by any programming language, and since it is just a text format, it can be easily transferred between machines.
Cartoon Network's Communities.com has a children's digital asset trading game called "Cartoon Orbit" (State's co-founders all worked at the company), using a browser plug-in with Customize the messaging system to change DHTML components. This is the beginning of the JSON library.
If the JSON file has syntax problems, the request will usually fail silently. Therefore, JSON data should not be manually edited frequently. The data exchange format JSON has higher syntax requirements than JavaScript's object literal representation. For example, all strings in a JSON representation, whether values or properties, need to be enclosed in double quotes
The JSON string is decrypted by JavaScript running in the user's browser, and the product data is displayed on the page.
Use JSON
As we have seen, JSON is an object type in the JavaScript programming language that stores data in the form of string literals, ending with the .json extension. JSON objects store data in key-value format, enclosed in curly braces just like JavaScript objects. Let’s see an example to better understand JSON code -
{ "key1" : "pair1", "key2" : "pair2", "key3" : { "sub-key1" : "opp_value", "sub_key2" : "opp_value", }, "key4" : { "sub-key1" : "opp_value", "sub_key2" : "opp_value", }, "key5" : "pair5", }
In the above JSON code, we can see that there are 5 key pairs, where the keys are in the form of simple strings. The key pairs can be strings or other objects, such as arrays, strings, etc. All key pairs are separated by commas and enclosed within curly braces.
Any data can be stored this way and can be passed or shared in a simple way using this format.
Storing Arrays in JSON
We have seen simple code for writing JSON objects, now let us see how users can store arrays in JSON objects -
{ "key1" : "pair1", "key2" : "pair2", "key3" : { "sub-key1" : "opp_value", "sub_key2" : "opp_value", }, "key4" : [ "sub-key1" : "opp_value", "sub_key2" : "opp_value", object1, object2 ], "key5" : "pair5", }
In the above code, we can see that the fourth key is stored in an array, not another object, which is supported by json.
Difference between JSON and XML
Both JSON and XML are used to store data and share or transfer data, and both are very good in their own league, let’s look at some of the differences between them -
Compared to XML, JSON is very easy to learn because it is not used directly.
-
Since JSON is just a straight string containing data in the form of a key pair, it is easy to read and write JavaScript objects, while XML is difficult to read and write
JSON is data-oriented and works that way, while XML is document-oriented.
JSON is not secure because it is only data-oriented, while XML is quite secure compared to JSON.
XML does not support arrays, while JSON provides tools that support arrays.
Similarities between XML and JSON
We've seen some of the differences between JSON and XML, now let's look at some of the things they have in common -
Since both XML and JSON contain text that humans can read, they are both self-describing
Both JSON and XML support hierarchical organization. When we talk about hierarchies, we mean values contained within values.
Data exchange formats Data exchange formats such as JSON and XML are supported by a variety of programming languages.
Both formats can be processed quickly and easily.
Retrieval: Both forms of data can be retrieved using HTTP requests. Data can be retrieved using GET, PUT, and POST methods.
in conclusion
In this article, we learned about JSON and its interesting facts through examples. JSON stands for JavaScript Object Notation, basically, JSON is often used with JavaScript and it was originally a subset of the JavaScript programming language. Arrays, objects, name and value pairs, and other data types can all be found in JSON. This format uses quotation marks, square brackets, parentheses, semicolons, and colons as punctuation marks.
The above is the detailed content of Interesting facts about JSON. For more information, please follow other related articles on the PHP Chinese website!

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr

Node.js excels at efficient I/O, largely thanks to streams. Streams process data incrementally, avoiding memory overload—ideal for large files, network tasks, and real-time applications. Combining streams with TypeScript's type safety creates a powe


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
