06:44
1,0×
00:00/06:44
367,3 тыс смотрели · 3 года назад
8 месяцев назад
​​​​​​​​​​​Json script JSON SCRIPTJSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is based on a subset of the JavaScript programming language, Standard ECMA-262 3rd Edition - December 1999. JSON is often used to transmit data between a server and web application as an alternative to XML.With JSON, you can easily represent complex data structures in a readable and concise manner. It consists of key-value pairs, similar to objects in JavaScript. Here is an example of a simple JSON object:{ "name": "John Doe", "age": 30, "city": "New York" }In this object, "name", "age", and "city" are keys, while "John Doe", 30, and "New York" are the corresponding values. Arrays can also be represented in JSON using square brackets. Here is an example:{ "employees": ["Alice", "Bob", "Charlie"] }JSON is commonly used in web development for sending and receiving data from APIs. It is language-independent, meaning it can be used with any programming language that has a JSON parser. Parsing JSON is straightforward in most programming languages. For example, in JavaScript, you can parse a JSON string into an object using the JSON.parse() method. Here is an example:javascript const jsonStr = '{"name": "Jane Doe", "age": 25}'; const obj = JSON.parse(jsonStr);console.log(obj.name); // Output: Jane Doe console.log(obj.age); // Output: 25 Likewise, you can convert a JavaScript object into a JSON string using the JSON.stringify() method. Here is an example:javascript const obj = { name: "Alice", age: 35 }; const jsonStr = JSON.stringify(obj);console.log(jsonStr); // Output: {"name":"Alice","age":35} In conclusion, JSON is a versatile and widely-used data format that simplifies data interchange in web applications. Its simplicity and ease of use make it a popular choice for developers when working with data.
119 читали · 2 года назад
Интерпретация JSON в Python – как читать файлы JSON
👋🏻 Привет! С вами снова Merion Academy - платформа доступного IT образования. JSON (JavaScript Object Notation – нотация объектов JavaScript) – это популярный способ структурирования данных. Он используется для обмена информацией между веб-приложением и сервером. Но как прочитать файл JSON в Python? В этой статье я покажу вам, как использовать методы json.loads() и json.load() для интерпретации (или как еще говорят парсинга) и чтения файлов и строк JSON. Синтаксис JSON Прежде чем мы приступим к интерпретации и чтению файла JSON, сначала нам нужно разобраться с основным синтаксисом...