Join our Newsletter — 33% off our NHI Course

JavaScript Object Notation

JavaScript Object Notation is a lightweight data format used to exchange structured information between systems and APIs. It is often abused when applications trust unsanitised input, leading to injection, deserialisation mistakes, or logic flaws. Defenders should validate fields, enforce schemas, and avoid exposing sensitive data in responses.

What JavaScript Object Notation is used for

JSON is the common interchange format for structured data in web applications, APIs, and automation workflows. Its value is portability: systems can exchange predictable objects, arrays, strings, numbers, booleans, and nulls without agreeing on a full programming language.

That simplicity is also why it is so widely embedded in application logic. Developers often treat JSON as “just data,” but the moment an application starts trusting fields, nesting, or types without validation, JSON becomes part of the security boundary rather than a neutral envelope.

Why JSON becomes a security concern

Problems usually appear when the receiving system assumes the payload matches the shape it expects. If an attacker can add unexpected properties, alter data types, or supply deeply nested input, the application may mis-handle authorisation decisions, parsing, or downstream deserialisation.

JSON also creates exposure when applications echo sensitive fields back to clients. A response that includes internal identifiers, tokens, debug state, or hidden attributes can turn a routine API interaction into data leakage. This is especially important in APIs that serve multiple clients or trust upstream services by default.

Where JSON is used as a serialisation format for objects, the risk rises further if the application deserialises untrusted content into executable program structures. That is why schema enforcement and strict field allow-listing matter more than ad hoc string checks.

How secure JSON handling works

Secure handling starts with defining the expected shape of each message and rejecting anything outside that contract. Schema validation, type enforcement, and explicit field mapping reduce ambiguity and make malformed or malicious input easier to block before business logic sees it.

It also helps to separate transport data from internal objects. Applications should avoid directly binding request bodies to privileged internal models, because that pattern makes mass assignment and hidden-field abuse easier. The safest implementations treat every JSON document as untrusted until it has been validated and normalised.

On the output side, responses should expose only the fields a client actually needs. Even when data originated from a trusted backend, over-sharing in JSON responses can create privacy issues, reveal implementation details, or assist later exploitation.

Where JSON fits in modern API and application security

JSON is not inherently dangerous, but it is the substrate for many API and application security failures because it sits at the boundary between untrusted clients and privileged business logic. That makes it a natural place to apply input validation, output filtering, and consistent error handling.

For API-specific risks such as broken object-level authorisation, broken authentication, and unsafe consumption of upstream services, the payload format matters because attackers often manipulate JSON objects to reach data or actions they should not control. The OWASP API Security Top 10 is useful for understanding those failure patterns in context.

JSON handling also benefits from general control discipline around configuration, logging, and integrity monitoring. Broad control catalogues such as NIST SP 800-53 Rev 5 Security and Privacy Controls help map JSON validation, auditability, and system integrity expectations to operational controls.

Risk and Threat Considerations

JSON becomes risky when the application treats attacker-controlled structure as trustworthy input. That can lead to injection, unsafe object binding, deserialisation flaws, and logic abuse that changes how the system interprets permissions, workflow state, or business data.

Failure mechanism: The attacker supplies a payload that passes superficial parsing but carries unexpected properties, malformed types, or nested content that the application binds into privileged logic or downstream deserialisation.

Impact: The result can be data exposure, unauthorised actions, integrity loss, or code-adjacent security failures, especially where the application reuses the same JSON model across multiple trust boundaries.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP API Security Top 10 API1 — Broken Object Level Authorization JSON payloads often carry object identifiers and access decisions.
API3 — Broken Object Property Level Authorization JSON fields can expose or modify properties callers should not control.
API8 — Security Misconfiguration Loose JSON parsing and unsafe defaults create avoidable API exposure.
Recommendation — Validate object references before processing JSON-driven requests. Restrict writable and readable JSON properties to the caller's entitlement. Harden JSON handling defaults and reject ambiguous request shapes.
NIST SP 800-53 Rev 5 SI-10 — Information Input Validation JSON security depends on validating untrusted structured input before use.
SC-23 — Session Authenticity JSON responses and tokens can be abused when application state is not integrity-protected.
Recommendation — Apply input validation to every JSON field before business logic consumes it. Protect state-bearing JSON exchanges against tampering and replay.

Practitioner Guidance

Why practitioners should care: JSON issues are usually control failures, not parser failures. The practical question is whether every producer and consumer of a JSON payload has an enforced contract, a minimal response shape, and a safe mapping layer between external input and internal state.

What to watch for: Be alert to endpoints that accept flexible JSON objects, silently ignore unknown fields, or return more data than the client requested. Those patterns often indicate that security depends on convention rather than enforcement.

Practitioner takeaway: Treat JSON as an attack surface at every trust boundary, and make validation, schema enforcement, and response minimisation the default rather than the exception.