What is JSON (JavaScript Object Notation)?

A text format for representing data, based on the way objects are written in JavaScript. It combines objects, which enclose name-value pairs in { }, and arrays, which list values in [ ], and values can be strings, numbers, true/false or null. Names and strings must always be enclosed in double quotation marks. It is more concise than XML and can be read and written by many programming languages, so it is widely used as the data format of web APIs. Its media type is application/json.

Japanese name: JSON

JSON (JavaScript Object Notation) appears in 3 practice questions across 2 topics, including Web Technology Basics, Cloud and Container Basics.

Field: Web Technology Basics

Try it: questions about JSON (JavaScript Object Notation)

A web API returns data in JSON format as the body of its response. Which of the following headers is generally added to the response to indicate the format of the body?

  1. AAccept: application/json
  2. BContent-Type: text/html
  3. CContent-Type: application/json
Show answer and explanation

Answer: C. Content-Type: application/json

The kind of data in the body is indicated by the Content-Type header, whose value is a media type (MIME type) in the form "type/subtype", such as text/html or image/png. The media type of JSON is application/json. JSON is a text format that represents data with name-value pairs and arrays, as in {"id": 42, "tags": ["a", "b"]}; it is more concise than XML and easy to handle from JavaScript, so it is widely used in web APIs. The Accept header is used in a request to tell the server which formats the client wants to receive.

JSON (JavaScript Object Notation) in the explanations

Questions that mention JSON (JavaScript Object Notation) (3)

  1. A web API returns data in JSON format as the body of its response. Which of the following headers is generally added to the response to indicate the format of the body?
  2. When a web server compresses responses with gzip or Brotli before sending them, which of the following generally gains the least reduction in transferred data from compression?
  3. An image named pinger, built from the Dockerfile above, is started with docker run pinger example.com. Which of the following is the command executed in the container?

Books on Web Technology Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

Docker Container Argument Cookie (HTTP cookie) CORS (cross-origin resource sharing) DOM (Document Object Model) Event loop HTTP (Hypertext Transfer Protocol) HTTP method HTTP status code

Back to the glossary