liveBook · Manning

JSON

As explained in Spring Start Here, Second Edition

JSON is a text-based data-interchange format that represents structured data using objects, arrays, values, and name-value pairs.

JSON (JavaScript Object Notation) is a text format for representing structured data as name-value pairs. In REST endpoints, Spring commonly formats returned Java objects as JSON and decodes JSON request bodies into Java objects. section 10.3.1 section 10.4

An object appears as paired names and values; a collection appears as an array of objects. If Spring cannot decode a JSON request body into the expected type, it returns a 400 Bad Request response. section 10.3.1 section 10.4

{
    "name": "France",
    "population": 67
}

A Country response becomes a JSON object with name and population fields. section 10.3.1

How Spring Start Here, Second Edition covers it

How deep it goes
Defines JSON as attribute-value text and demonstrates object and collection representations, without detailing the format’s full syntax.
Examples
Shows Country objects and arrays in responses, plus a payment request containing an amount.
What you can do after
Apply it through Spring REST endpoints to send object responses and provide request data for decoding.
How it connects
Connects JSON with REST APIs, HTTP request and response bodies, and Spring object conversion.

Also explained in

Compare how 42 books explain JSON →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.