Interview kitsBlog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2026 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Data Structures
Data Structureseasy

Example of valid JSON structure

Tags
#json#format#example
Back to categoryPractice quiz

Answer

Valid JSON is a text format for objects and arrays using {} and [], where keys and string values are in double quotes, and values can be only: string, number, boolean, null, array, or object. Example: { "name": "John", "age": 30, "roles": ["dev"], "active": true }.

{
  "name": "John Doe",
  "age": 30,
  "isEmployed": true,
  "roles": ["developer", "admin"],
  "address": {
    "city": "New York",
    "zip": "10001"
  }
}

Advanced answer

Deep dive

Expanding on the short answer — what usually matters in practice:

  • Context (tags): json, format, example
  • Complexity: compare typical operations (average vs worst-case).
  • Invariants: what must always hold for correctness.
  • When the choice is wrong: production symptoms (latency, GC, cache misses).
  • Explain the "why", not just the "what" (intuition + consequences).
  • Trade-offs: what you gain/lose (time, memory, complexity, risk).
  • Edge cases: empty inputs, large inputs, invalid inputs, concurrency.

Examples

Here’s an additional example (building on the short answer):

{
  "name": "John Doe",
  "age": 30,
  "isEmployed": true,
  "roles": ["developer", "admin"],
  "address": {
    "city": "New York",
    "zip": "10001"
  }
}

Common pitfalls

  • Too generic: no concrete trade-offs or examples.
  • Mixing average-case and worst-case (e.g., complexity).
  • Ignoring constraints: memory, concurrency, network/disk costs.

Interview follow-ups

  • When would you choose an alternative and why?
  • What production issues show up and how do you diagnose them?
  • How would you test edge cases?

Related questions

Spring
Spring MVC `@RequestBody`: what does it do and a common pitfall?
#spring#mvc#requestbody
PostgreSQL
JSON vs JSONB in Postgres — what’s the difference (and why JSONB is common)?
#json#jsonb#gin