# What Is JSON? Meaning, Syntax, Examples, and Uses

> JSON is a text format for storing and sending structured data between apps. Learn its syntax, data types, examples, uses, JSON vs XML, and validation.

**URL:** https://www.ciptadusa.com/blog/json-adalah  
**Type:** blog  
**Author:** PT Cipta Dua Saudara  
**Category:** Engineering  
**Published:** 2026-10-31  
**Cover:** https://www.ciptadusa.com/media/uploads/blog/2026-10/1793413078604-json-adalah-20261031.webp  

## Article

JSON stands for JavaScript Object Notation, a text format for storing and sending structured data between applications. JSON data is written as name and value pairs inside curly braces, for example `{"name": "Budi", "active": true}`, so people can read it and machines can process it. The official json.org site describes JSON as a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate ([source](https://www.json.org/json-en.html)).

The format shows up when a web app requests data from a server through an API, when a payment gateway sends a webhook notification, when an app stores a configuration file, and when a database stores semi-structured data. This article covers what JSON is, its structure and data types, an example, its uses, how parsing works, JSON vs XML, mistakes that make JSON invalid, and how to validate it with JSON Schema.

## What Is JSON?

Formally, JSON is standardized by two documents. Ecma International's ECMA-404 defines JSON as a lightweight, text-based, language-independent syntax for defining data interchange formats. It was derived from ECMAScript (JavaScript) but can be used from any programming language ([source](https://ecma-international.org/publications-and-standards/standards/ecma-404/)). The second document is IETF RFC 8259, published in December 2017, which obsoletes RFC 7159 ([source](https://www.rfc-editor.org/rfc/rfc8259)).

One point in ECMA-404 matters in practice: the standard only defines the syntax of valid JSON, not the meaning of the data. Meaningful interchange requires the parties involved to agree on the semantics of each field ([source](https://ecma-international.org/publications-and-standards/standards/ecma-404/)). In integration work, that agreement lives in the API documentation or a data schema.

MDN explains that JSON can be stored in a text file with the `.json` extension and the `application/json` MIME type ([source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)). The `application/json` media type is registered with IANA, with RFC 8259 as its published specification ([source](https://www.iana.org/assignments/media-types/application/json)).

### Is JSON a Programming Language?

No. JSON is a data format, not a programming language. It has no variables, loops, or functions. MDN notes that JSON can only contain serializable data types, so functions and objects such as `Date`, `Set`, or `Map` are excluded ([source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)). Because it is language independent, JSON produced in PHP can be read in Go, Python, Java, or JavaScript.

## JSON Structure and Syntax

According to json.org, JSON is built on two structures ([source](https://www.json.org/json-en.html)):

- Object: a collection of name/value pairs wrapped in curly braces `{ }`. Other languages call this a record, struct, dictionary, hash table, or associative array.
- Array: an ordered list of values wrapped in square brackets `[ ]`. Other languages call this a list, vector, or sequence.

Each name (key) in an object is a string, followed by a colon and then the value. Pairs are separated by commas. Whitespace and line breaks between tokens are allowed and do not change the meaning of the data ([source](https://www.rfc-editor.org/rfc/rfc8259)).

### JSON Data Types

RFC 8259 states that JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and arrays) ([source](https://www.rfc-editor.org/rfc/rfc8259)).

| Type | Example | Notes |
| --- | --- | --- |
| String | `"Bandung"` | Must use double quotes |
| Number | `125000`, `4.5`, `-2` | Decimal notation, no quotes |
| Boolean | `true`, `false` | Lowercase, no quotes |
| Null | `null` | Represents an empty value |
| Object | `{"city": "Bandung"}` | Name and value pairs |
| Array | `["A", "B", "C"]` | Ordered list of values |

The rules in this table follow RFC 8259 and MDN ([source](https://www.rfc-editor.org/rfc/rfc8259), [source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)).

## JSON Example

Below is an order record in JSON. The data is fictional, a CDS illustration showing every data type:

```json
{
  "order_number": "INV-2026-0042",
  "date": "2026-10-31",
  "customer": {
    "name": "CV Maju Bersama",
    "city": "Bandung"
  },
  "items": [
    { "sku": "KRS-01", "name": "Office chair", "qty": 4, "price": 850000 },
    { "sku": "MJ-02", "name": "Meeting table", "qty": 1, "price": 2400000 }
  ],
  "paid": false,
  "notes": null
}
```

From this example:

- `customer` is an object nested inside the main object.
- `items` is an array that holds two objects.
- `qty` and `price` are numbers, `paid` is a boolean, and `notes` is null.
- `date` is a string because JSON has no date type. MDN notes that `Date` objects are not a JSON data type ([source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)), so the date format has to be agreed on in the API documentation.

## What JSON Is Used For

### Exchanging Data Through APIs

MDN explains that JSON is used to transmit data in web applications, for example from the server to the client so it can be displayed on a page, or the other way around ([source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)). This pattern is the basis of communication between the [frontend](/en/blog/frontend-adalah) and the [backend](/en/blog/backend-adalah): the frontend sends a request to an [API](/en/blog/api-adalah), and the backend replies with a JSON response.

### Webhook Payloads

When an event happens, such as a successful payment or an incoming WhatsApp message, a third-party service sends an HTTP request to your server. The body of that request is the payload. The full pattern is covered in our article on [webhooks](/en/blog/webhook-adalah), including a JSON payload example from the WhatsApp Cloud API.

### Integrating Systems

The IANA registry entry notes that JSON has been used to exchange data between applications written in many languages, including C, C#, Go, Java, JavaScript, Perl, and PHP ([source](https://www.iana.org/assignments/media-types/application/json)). That makes JSON a practical shared format when connecting an ERP, a CRM, and a point-of-sale app in a [system integration](/en/blog/integrasi-sistem-adalah) project or through a [middleware](/en/blog/middleware-adalah) layer.

### Storing Data in a Database

PostgreSQL offers two column types: `json` and `jsonb`. The `json` type stores an exact copy of the input text, while `jsonb` stores data in a decomposed binary format that is slightly slower to input but significantly faster to process because no reparsing is needed. The PostgreSQL documentation says most applications should prefer `jsonb` unless they have specialized needs such as legacy assumptions about the order of object keys ([source](https://www.postgresql.org/docs/current/datatype-json.html)).

### Logs and Line-by-Line Data

For log files there is a variant called JSON Lines (newline-delimited JSON). Each line holds one valid JSON value, the file uses UTF-8 encoding, and the line terminator is `\n`. The format makes it easy to process data one record at a time ([source](https://jsonlines.org/)).

### Structured Data for SEO

On the SEO side, a web page's structured data can be written in JSON-LD inside a `<script>` tag. Google lists JSON-LD as the recommended format, while noting that all three supported formats are equally fine for Google as long as the markup is valid ([source](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data?hl=en)).

### Tokens and Protocols

JSON is also the foundation of other standards. JSON Web Token (JWT), defined in RFC 7519, is a compact, URL-safe means of representing claims transferred between two parties, for example for authentication ([source](https://www.rfc-editor.org/rfc/rfc7519)). The Model Context Protocol (MCP), which connects AI agents to tools, requires all messages between clients and servers to follow the JSON-RPC 2.0 specification ([source](https://modelcontextprotocol.io/specification/2025-06-18/basic), [source](https://www.jsonrpc.org/specification)).

## How JSON Works: Serialization and Parsing

Data inside a program (objects, arrays, structs) cannot be sent over a network as is. It has to be converted to JSON text first and then converted back on the receiving side. MDN calls converting an object into a string serialization, and converting a string into an object deserialization ([source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)).

In JavaScript, the two built-in methods for this are `JSON.stringify()` and `JSON.parse()` ([source](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify), [source](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)):

```javascript
// Serialization: object -> JSON text
const order = { number: "INV-2026-0042", qty: 4, paid: false };
const text = JSON.stringify(order);
// '{"number":"INV-2026-0042","qty":4,"paid":false}'

// Parsing: JSON text -> object
const data = JSON.parse(text);
console.log(data.qty); // 4
```

In Python, the standard `json` module provides `json.dumps()` for serialization and `json.loads()` for parsing ([source](https://docs.python.org/3/library/json.html)). Go, PHP, and Java have similar functions in their standard libraries or widely used libraries.

Some behavior deserves attention. MDN shows that `JSON.stringify()` turns `undefined`, functions, and Symbols inside an array into `null`, and throws an error when it meets a BigInt value ([source](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)). `JSON.parse()` throws a `SyntaxError` when the text being parsed is not valid JSON ([source](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)).

## JSON vs XML

XML (Extensible Markup Language) is a markup format standardized by the W3C that is also used for data exchange ([source](https://www.w3.org/TR/xml/)). How the two differ in structure:

| Aspect | JSON | XML |
| --- | --- | --- |
| Shape | Name/value pairs, objects, and arrays | Elements with opening and closing tags, optional attributes |
| Data types | Has string, number, boolean, null | Element content is text; types come from a schema |
| Arrays | Built in (`[ ]`) | None; represented by repeated elements |
| Comments | Not allowed | Allowed (`<!-- -->`) |
| Standard | ECMA-404 and RFC 8259 | W3C XML 1.0 |
| Use in JavaScript | Built-in `JSON.parse()` | Needs a DOM parser |

CDS compiled this table from the JSON specification ([source](https://www.rfc-editor.org/rfc/rfc8259)), MDN ([source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)), and the W3C XML 1.0 specification ([source](https://www.w3.org/TR/xml/)). In real projects the choice follows the system you need to talk to. If a legacy system only accepts XML, the integration still has to produce XML.

## Mistakes That Make JSON Invalid

JSON that looks right can still be rejected by a parser because it breaks a syntax rule. Based on the rules MDN lists, these mistakes make JSON invalid ([source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)):

- Strings or key names in single quotes. JSON requires double quotes.
- A comma after the last item of an object or array (trailing comma), for example `{"a": 1,}`.
- Comments with `//` or `/* */`. JSON does not allow comments.
- Values such as `undefined`, `NaN`, or `Infinity`. None of them are JSON types.

RFC 8259 also points out several interoperability traps ([source](https://www.rfc-editor.org/rfc/rfc8259)):

- Names within an object SHOULD be unique. With duplicate keys, receivers can behave differently. For example, PostgreSQL `jsonb` keeps only the last value of a duplicated key ([source](https://www.postgresql.org/docs/current/datatype-json.html)).
- Number precision depends on the implementation. RFC 8259 advises not to expect more precision or range than IEEE 754 binary64 (double precision) numbers provide. For long IDs or amounts that need full precision, send them as strings.
- JSON exchanged outside a closed ecosystem must be encoded in UTF-8, and implementations must not add a byte order mark (BOM) at the start of the text.

## Validating JSON with JSON Schema

Syntactically valid JSON is not necessarily correct data. A `qty` field might arrive as a string, or a required field might be missing. JSON Schema addresses this: it is a declarative language for defining the structure and constraints of JSON data, and its current version is 2020-12 ([source](https://json-schema.org/overview/what-is-jsonschema)).

A simple schema for the order items above (CDS illustration):

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "required": ["sku", "qty", "price"],
  "properties": {
    "sku": { "type": "string" },
    "qty": { "type": "integer", "minimum": 1 },
    "price": { "type": "number", "minimum": 0 }
  }
}
```

With a schema like this, the backend can reject non-conforming requests before the data reaches the database. The same schema doubles as documentation of the data contract between frontend, backend, and third-party teams.

On the security side, OWASP recommends using a safe, standard data interchange format such as JSON when you need to pass serialized data to the user, instead of a language's native serialization format ([source](https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html)). External JSON still has to be validated before it is processed.

## Checklist for Using JSON in Business Applications

This checklist is CDS internal guidance for designing APIs and integrations:

1. Agree on field names and formats in the API documentation, including date format and time zone.
2. Send money amounts and long IDs as strings or as integers in the smallest unit, not as decimal numbers.
3. Validate every request and webhook payload with JSON Schema or a backend validator.
4. Make sure the `Content-Type: application/json` header and UTF-8 encoding are in place.
5. Handle parsing errors with clear messages instead of letting the app crash.
6. Log payloads that fail processing (with sensitive data masked) so they can be traced.
7. Version the API so changes to the JSON structure do not break older apps.

## JSON in CDS Projects

Through its [custom software development](/en/services/software) service, CDS builds web apps, mobile apps, internal dashboards, and API integrations, with REST APIs and webhooks as part of the stack. For legacy systems that need to be connected or moved, for example during a [data migration](/en/blog/migrasi-data-adalah) from spreadsheets to a new app, the CDS [IT consulting](/en/services/consulting) service helps map the data flows and architecture.

CDS also develops [Zetta CRM](/en/incubating/zetta-crm), a Go-based MCP server for AI agents accessed through a `POST /mcp` endpoint with an API key. Because it uses MCP, its messages follow JSON-RPC 2.0, which is built on JSON.

## JSON FAQ

### What does JSON stand for?

JSON stands for JavaScript Object Notation, a text format for data interchange whose syntax comes from JavaScript but which can be used from any programming language ([source](https://ecma-international.org/publications-and-standards/standards/ecma-404/)).

### What kind of file is JSON?

A JSON file is a plain text file with the `.json` extension and the `application/json` MIME type ([source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)). Any text editor can open it.

### What is JSON used for?

JSON is used to store and send structured data, such as API responses, webhook payloads, configuration files, SEO structured data (JSON-LD), and semi-structured columns in databases.

### What is JSON data?

JSON data is data written according to JSON rules: objects in curly braces, arrays in square brackets, and values that are strings, numbers, booleans, null, objects, or arrays ([source](https://www.rfc-editor.org/rfc/rfc8259)).

### What is the difference between JSON and a JavaScript object?

JSON is text, while a JavaScript object is a data structure in program memory. JSON is stricter: keys need double quotes, and functions, comments, and trailing commas are not allowed ([source](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON)).

### Can JSON be used as a database?

JSON can be stored in a database, for example in a PostgreSQL `jsonb` column ([source](https://www.postgresql.org/docs/current/datatype-json.html)). A plain JSON file, however, lacks database features such as transactions, indexes, and access control, so core business data still belongs in a database.

## Need Clean APIs and Data Integrations?

If your application needs to exchange data with a payment gateway, marketplace, ERP, or CRM, the CDS team can design the API, the JSON schema, and its validation from the start so the integration stays reliable. Start with [custom software development](/en/services/software), discuss the architecture through [IT consulting](/en/services/consulting), or browse [CDS works](/en/works) first.


---

*Markdown version of https://www.ciptadusa.com/blog/json-adalah — generated for AI agents and LLM crawlers.*
