By the end of this lesson you will understand what JSON is, why it became the standard way programs share data, and how to read and write it confidently in a Spring Boot service.
Picture this: you're building EngineerPrep's backend in Java. You have a Question object in memory — it has an ID, some text, a difficulty level, and a list of tags. Your React frontend teammate needs that same data. But React doesn't know what a Java object is. It can't reach into your JVM's memory and pull out a Question . You need to send the data across a wire — through HTTP, from your Spring Boot server to their browser. Your first instinct might be: just send the raw text. But how do you tell where the question text ends and the tags begin? How do you say 'this field is a number, not a string'? Plain text doesn't have structure. So the real question is: how do two programs agree on a shared language for structured data? That's the exact problem JSON was built to solve — and by the end of this lesson, you'll see why it became the answer everyone uses.
Think of JSON like a universal form . Imagine you work at a company with offices in Tokyo and New York. You need to send employee records between them. You could write it in Japanese or English — but not everyone reads both. Instead, you agree on a standard form: boxes with labels, filled in with values, that anyone can read regardless of their native language. JSON does the same thing for programs. JSON stands for JavaScript Object Notation. 'Notation' just means 'a way of writing something down.' Despite the JavaScript name, every major programming language — Java, Python, Go, Rust — can read and write JSON. It's widely supported across the industry. Here's the core idea: JSON represents data as plain text, using a small set of simple rules everyone agrees on: - Data is organized into key-value pairs — a label and its value, like "difficulty": "MEDIUM" .…
Imagine a single EngineerPrep question traveling from the Java backend to the React frontend. Step 1 — The Java object lives in memory. Inside your Spring Boot service, you have a Question object. Think of it as a labeled box sitting on a shelf in your server's memory. It has slots labeled id , text , difficulty , and tags . The slots are filled with real values. Only your Java program can open this box — it's in Java's private memory format. ┌─────────────────────────────────────┐ │ Question (Java Object) │ │ id: 42 │ │ text: "What is a deadlock?" │ │ difficulty: MEDIUM │ │ tags: "threads","Java" │ └─────────────────────────────────────┘ (lives only inside the JVM) Step 2 — Your framework serializes it.…
Here's a minimal but real EngineerPrep-style endpoint that returns a question as JSON. We'll go through it a few lines at a time. The data class java public class Question { private Long id; private String text; private String difficulty; private List<String tags; // constructors, getters, setters omitted for brevity } This is a plain Java class — no JSON-specific code anywhere. That's intentional. Spring Boot handles the conversion for you. The controller java @RestController @RequestMapping("/api/questions") public class QuestionController { private final QuestionService questionService; public QuestionController(QuestionService questionService) { this.questionService = questionService; // constructor injection…