Lucia / KNOWLEDGE & LEARNING

← Back to Library

Article / Data & Structure ± 4 MIN READ

JSON: when data has structure

Read name–value pairs, lists, and the difference between text and numbers.

A message programs can read

Imagine sending a reading list to another program. Free-form sentences are easy for people to understand, but programs need explicit rules. JSON provides a text format with a structure many languages recognize.

Its name comes from JavaScript, but its use extends beyond that language. JSON stores data, rather than commands to execute.

{
  "title": "Web Basics",
  "lessons": 5,
  "completed": false,
  "topics": ["web", "data"]
}

Names, values, and lists

Curly braces wrap an object: name–value pairs. In the example, title is a name and ‘Web Basics’ is its value. Names are double-quoted strings. A colon separates each name from its value; commas separate pairs.

Square brackets wrap an array, an ordered sequence of values. Order matters: a sequence of learning steps is read by position. By contrast, avoid making a program depend on object member order.

Text is different from a number

String is text. The values 5 and ‘5’ have different types despite looking similar. In the example, lessons is a number, completed is a boolean, and topics is an array. JSON also has null for an explicitly empty value.

JSON syntax is strict. Names and text use double quotes, and the last member has no trailing comma. Comments are not part of standard JSON. A JavaScript object snippet is not automatically valid JSON.

Start by reading, rather than memorizing

Read the example like a catalog card: what is its title, how many lessons does it contain, is it completed, and which topics appear? You do not need to execute this data to understand it.

If the structure is confusing, find matching brackets first. Then read each name and identify its value’s type. This habit helps when you encounter API responses or configuration files.

TRY TO UNDERSTAND

One question before moving on.

Which value is a string in JSON?

SOURCES & FURTHER READING

The concepts behind the reading.

Open Lexicon ↗

Lucia LEXICON / SHORT DEFINITION

Understand this concept

Search knowledge in Lucia

LADDER / LEARNING MATERIAL

What is HTML?HTML FundamentalsYour First HTML DocumentHTML FundamentalsInside the HeadHTML FundamentalsEdit, Preview, RepeatHTML FundamentalsTrial 1HTML FundamentalsTags vs. ElementsHTML FundamentalsUnderstanding AttributesHTML FundamentalsNesting & Void ElementsHTML FundamentalsComments & Character ReferencesHTML FundamentalsTrial 2HTML FundamentalsHeadings & ParagraphsHTML FundamentalsEmphasis, Importance & QuotesHTML FundamentalsListsHTML FundamentalsText with MeaningHTML FundamentalsTrial 3HTML FundamentalsLinks & URLsHTML FundamentalsFiles, Folders & NavigationHTML FundamentalsImages & Alternative TextHTML FundamentalsFigures, Audio & Video BasicsHTML FundamentalsTrial 4HTML FundamentalsPage LandmarksHTML FundamentalsSections & ArticlesHTML FundamentalsDiv, Span, ID & ClassHTML FundamentalsAccessible NavigationHTML FundamentalsTrial 5HTML FundamentalsWhen to Use a TableHTML FundamentalsRows & CellsHTML FundamentalsCaptions & HeadingsHTML FundamentalsAccessible TablesHTML FundamentalsTrial 6HTML FundamentalsForms & LabelsHTML FundamentalsInputs & Field ValuesHTML FundamentalsMore Form ControlsHTML FundamentalsBuilt-in Validation & SubmissionHTML FundamentalsTrial 7HTML FundamentalsPlan Your WebsiteHTML FundamentalsBuild the StructureHTML FundamentalsAdd Media & FormsHTML FundamentalsValidate, Debug & ReviewHTML FundamentalsMy First HTML WebsiteHTML Fundamentals

LEXICON / CONCEPTS

BrowserAn application for opening, displaying, and interacting with web pages.HTTPA protocol for exchanging requests and responses between web clients and servers.HTMLA markup language that gives structure and meaning to web content.JSONA text format for storing or exchanging structured data.DNSA distributed naming system that associates domain names with information such as IP addresses.HTTPSHTTP using TLS to protect data exchanges in transit.ServerSoftware or a computer that provides services to clients.URLAn address identifying a resource’s location and how to access it.Domain nameA hierarchical name identifying part of the internet’s naming system.LinkA reference you can follow to a resource or another part of a document.CSSA stylesheet language for controlling web document appearance and layout.JavaScriptA programming language that can add dynamic behavior to web pages.DOMA document representation structured as objects that APIs can read and modify.JSON objectA collection of name–value pairs in JSON, written inside curly braces.ArrayAn ordered sequence of JSON values, written inside square brackets.StringA sequence of characters representing text; JSON encloses it in double quotes.CompressionA way to represent data using less space.TransparencyAn image’s ability to let the background show through fully or partially.Raster imageAn image made from a pixel grid with defined dimensions.Alternative textText conveying an image’s function or meaning when the image cannot be seen.HTML elementA unit of markup that gives content structure or meaning.HTML tagA marker in angle brackets that opens or closes an element.HTML attributeAdditional information on an element’s opening tag.HeadThe part of an HTML document that holds page metadata.TitleThe name of an HTML document, usually displayed in browser tabs and bookmarks.MetaAn element for metadata not covered by other metadata elements.Character encodingRules connecting text characters with byte representations.ViewportThe area in which a browser displays a page on a device.Void elementAn HTML element with no child content or closing tag.Character referenceA way to write a character through a named or numeric reference in HTML.HeadingThe h1 through h6 elements, which identify heading levels in document content.Semantic HTMLUsing HTML elements according to their content’s meaning and function.AccessibilityThe practice of making content and interactions usable by people with varied abilities.HTML listA structure for grouping items, with or without meaningful order.Relative pathA resource address resolved from the document’s location or base URL.Figure & figcaptionElements that group self-contained content with a visible caption.LandmarkA major page region that helps users recognize and navigate its structure.HTML tableA row and column structure presenting data with two-dimensional relationships.HTML formA group of controls that lets users enter or select data.Form labelA name explaining a form control and connected to it programmatically.HTML validationChecking markup conformance or, for forms, compliance with declared field rules.