JSON for Beginners: A Practical Guide | Load8it
Load8it › Learning Centre › JSON for Beginners
Web Development

JSON for Beginners: A Practical Guide

JSON is a compact text format used to represent structured data. You will see it in APIs, configuration files, exports and web applications. It looks simple, but a missing quote, comma or bracket can make an otherwise sensible document invalid.

What is JSON?

JSON stands for JavaScript Object Notation. It represents information using a small set of structures and value types that are easy for software to exchange and relatively easy for people to read.

A simple JSON object might describe a tool:

{ "name": "Word Counter", "category": "Text", "free": true, "features": 4 }

Objects and key-value pairs

A JSON object is wrapped in curly braces. Inside it, each property has a key and a value separated by a colon. Property names are strings and therefore use double quotation marks.

{ "site": "Load8it", "type": "tool collection" }

Multiple properties are separated by commas. There should not be a comma after the final property in standard JSON.

Arrays

An array is an ordered list wrapped in square brackets. Its items can be strings, numbers, booleans, null values, objects or even other arrays.

{ "categories": [ "Images", "PDF", "SEO" ] }

The main JSON value types

Type Example Meaning
String "Load8it" Text enclosed in double quotes.
Number 100 A numeric value, without quotation marks.
Boolean true Either true or false.
Null null An explicit null value.
Object {"name":"Tool"} A collection of key-value pairs.
Array ["PDF","SEO"] An ordered list of values.

A more realistic example

Objects and arrays can be nested to represent richer information:

{ "site": "Load8it", "active": true, "tools": [ { "name": "JSON Formatter", "category": "Developer" }, { "name": "Meta Tag Generator", "category": "SEO" } ] }

Here, tools is an array containing two objects. Each object contains its own properties.

Formatting versus validity

Pretty formatting adds indentation and line breaks so JSON is easier for a person to inspect. Minified JSON removes unnecessary whitespace to make the text more compact. Either can be valid JSON.

Important: Making JSON look tidy does not automatically make incorrect data valid. A formatter or validator can help expose syntax problems, but you should still understand what the data is supposed to represent.

Common JSON errors

  • Using single quotes around keys or strings instead of double quotes.
  • Forgetting a comma between properties or array items.
  • Leaving a trailing comma after the final item.
  • Missing a closing curly brace or square bracket.
  • Putting quotation marks around values that were intended to be numbers or booleans.
  • Writing True, False or None instead of JSON's lowercase true, false and null.
  • Including comments in ordinary JSON, which standard JSON syntax does not support.

Example of invalid JSON

{ 'name': "Load8it", "free": True, }

This has several problems: the first key uses single quotes, the boolean is incorrectly capitalised, and there is a trailing comma after the final property.

The corrected version

{ "name": "Load8it", "free": true }

A simple debugging workflow

  1. Start at the first error reported rather than trying to fix everything at once.
  2. Check matching braces { } and brackets [ ].
  3. Check that property names and text strings use double quotes.
  4. Inspect commas between neighbouring items.
  5. Check booleans and null values for the correct lowercase spelling.
  6. Format the JSON so nested structures are easier to see.
  7. Validate again after making the correction.
Be careful with private data: JSON can contain API responses, account information, tokens or other sensitive values. Read the data before pasting it into any third-party service, and follow the security rules that apply to the information you are handling.

JSON is data, not a magic instruction format

Valid JSON means the text follows JSON syntax. It does not mean the values are accurate, safe or accepted by a particular application. An API can reject perfectly valid JSON because a required field is missing, a value is outside an allowed range or the data structure does not match its expected schema.

Think of it this way: syntax asks “Is this written as valid JSON?” An application's rules ask “Is this the JSON structure and information I expected?” Those are related but different questions.

Format JSON with Load8it

Paste JSON into the matching Load8it utility to make the structure easier to inspect. Always review sensitive data before placing it into any tool.

JSON FAQs

Does JSON allow single quotes?

Standard JSON uses double quotation marks for property names and string values. Single quotes are not valid substitutes.

Can JSON contain comments?

Standard JSON syntax does not include comments. Some applications support related formats or extensions, but that should not be assumed for ordinary JSON.

Is formatted JSON different from minified JSON?

The represented data can be the same. Pretty formatting adds whitespace for readability, while minification removes unnecessary whitespace.

Does valid JSON mean an API will accept it?

No. The JSON may be syntactically valid but still fail the API's required structure, field or value rules.