Advanced Features and Hidden Powers of JSON You Should Know - Part 2
JSON continues to evolve far beyond just APIs and configuration files. While Part 1 covered JSON Schema, JSONPath, JSON-LD, and other powerful tools, this second part dives even deeper into advanced applications, performance tuning, innovations, and future trends. If you want to become a JSON expert, this guide will help you move from “advanced” to “mastery”.
1. Binary JSON Formats: Performance Upgrade
Standard JSON is human-readable but not the most efficient for storage or speed. That’s where binary JSON formats come in. These are optimised versions used in databases, messaging systems, and performance-critical applications.
Common formats:
- BSON (Binary JSON) – Used in MongoDB. Supports additional data types like
Date
andBinary
. - MessagePack – Compact and fast. Popular in mobile apps and IoT.
- CBOR (Concise Binary Object Representation) – Ideal for constrained environments like embedded systems.
These formats reduce payload size, boost speed, and are essential when working with big data or real-time systems.
2. JSON Web Tokens (JWT): Secure Identity Sharing
JWT is a popular standard for secure user authentication and session management. It’s used widely in login systems, mobile apps, and OAuth protocols.
A JWT is just a JSON object encoded in base64 and signed. It has three parts:
- Header
- Payload (data like user ID, role, expiry)
- Signature (for verification)
Example Payload:
{
"sub": "user123",
"role": "admin",
"exp": 1723459123
}
JWTs are compact, secure, and stateless — ideal for APIs and single sign-on systems.
3. JSON-RPC: Remote Calls with JSON
JSON-RPC is a lightweight protocol that allows you to make function calls remotely using JSON.
Example request:
{
"jsonrpc": "2.0",
"method": "getUser",
"params": [101],
"id": 1
}
It is often used in Ethereum, Bitcoin, and automation platforms where standard REST APIs are too bulky or inflexible.
4. JSON and AI: Structured Prompts for LLMs
With the rise of AI and large language models (LLMs), JSON is becoming a structured way to define prompts and receive responses.
Use cases:
- Defining tools/actions in agents (like OpenAI function calling)
- Formatting structured output for AI systems
- Feeding nested contexts to models
For example, you can ask an AI to respond in JSON like:
{
"answer": "The capital of France is Paris.",
"confidence": 95
}
This makes integration between AI and systems seamless and predictable.
5. Streaming APIs with NDJSON
NDJSON (Newline Delimited JSON) is a format where each line is a valid JSON object. It’s used in real-time logging, telemetry, and streaming APIs.
Example:
{"event":"login","user":"user1"}
{"event":"click","target":"button"}
NDJSON is easier to stream and process line-by-line without loading the entire payload into memory.
6. JSON Modules in JavaScript (Experimental)
Modern browsers and Node.js are beginning to support native import
of JSON as modules. Earlier, you had to use require()
or fetch files dynamically.
Now you can do:
import config from './settings.json' assert { type: 'json' };
This makes JSON usage in modular frontend projects smoother and future-proof.
7. Compression Techniques for JSON APIs
To optimise JSON performance on slow networks, compression is key.
Popular options:
- Gzip – Standard for most REST APIs
- Brotli – Smaller files, supported in modern browsers
- zlib/deflate – Used in WebSockets and custom protocols
Always enable compression headers like Accept-Encoding
in your HTTP server to reduce latency.
8. JSON Transformation with JQ, XSLT-like Tools
We already discussed jq
, but let’s go deeper.
jq allows you to map, reduce, and filter JSON directly from the terminal. For example:
jq '.users[] | {name, email}' users.json
Other tools include:
yq
– jq for YAML, also supports JSONJolt
– Used in Java JSON pipelinesJMESPath
– A powerful querying language used in AWS
These are critical for CLI-based automation, DevOps, and CI/CD workflows.
9. JSON in OpenAPI and AsyncAPI
Modern API documentation and mock generation rely on JSON.
- OpenAPI (Swagger) – Uses JSON Schema to define REST endpoints
- AsyncAPI – For defining message-driven APIs, often with JSON events
These specs are machine-readable, meaning you can auto-generate documentation, SDKs, and even live API dashboards.
10. JSON + GraphQL: Structured Yet Flexible
Although GraphQL often uses its own query language, it returns responses in JSON. Understanding how to manipulate and transform JSON helps when working with:
- Apollo Client / Server
- Relay (Facebook)
- Headless CMS systems like Strapi or Contentful
GraphQL brings typed queries, while JSON handles the data — best of both worlds.
Bonus: JSON and IndiaStack APIs
In India’s evolving digital public infrastructure, JSON is the default format for interoperable data exchange.
Some innovative uses include:
- Aadhaar eSign & DigiLocker integrations
- ONDC seller catalogues in JSON
- Account Aggregator APIs – Share financial data securely via JSON
- Health stack – Ayushman Bharat APIs use JSON FHIR format
This makes JSON a core element of India’s digital transformation.
Final Thoughts
We’ve moved from beginner to expert to now power-user level. JSON is not just about key-value pairs anymore — it's a powerful tool that integrates with authentication, blockchain, AI, streaming, APIs, and global digital transformation.
By understanding advanced topics like JSON-RPC, JWT, NDJSON, and OpenAPI, you can work across complex systems with confidence.
Stay curious, keep exploring, and remember — JSON is not just a data format. It’s a language for the future of information exchange.
Coming Soon: Want to go further? Our next article will cover real-world JSON project examples with use cases and code. Stay tuned at PrimaryCalc Blog.