What is JSON?
JSON stands for JavaScript Object Notation. It is a lightweight, text-based data interchange format designed to be easy for humans to read and write, and simple for machines to parse and generate.
Although derived from a subset of JavaScript’s object syntax, JSON is completely language-independent. Virtually every modern programming language (Python, Java, C#, Go, Ruby, PHP, etc.) has built-in support or robust libraries to read and write JSON.
History of JSON
Discovery and Formalization
Early 2001
Douglas Crockford and Chip Morningstar first conceived and formalized the JSON data format at State Software as a lightweight alternative to complex XML formats.
Domain Launch
2002
The official specification was published at json.org, making the syntax widely available to developers worldwide.
First Official RFC
2006
The Internet Engineering Task Force (IETF) published RFC 4627, standardizing JSON and assigning it the MIME media type application/json.
Ecma & ISO Standards
2013
JSON was formally adopted as an international standard under ECMA-404 and later recognized under ISO/IEC 21778:2017.
JSON Syntax and Data Types
JSON structures are built on two core structures:
- Objects: A collection of key-value pairs wrapped in curly braces
{}. Keys must be double-quoted strings. - Arrays: An ordered list of values wrapped in square brackets
[].
Supported Data Types
| Data Type | Description | Example |
| String | Text wrapped in double quotes | "Alice" |
| Number | Integer or floating-point number | 42, 3.14 |
| Boolean | Logical truth value | true or false |
| Array | Ordered collection of values | ["apple", "banana"] |
| Object | Nested collection of key/value pairs | {"city": "Paris"} |
| Null | Empty or nonexistent value | null |
Practical Examples
1. Simple User Profile
JSON
{
"id": 101,
"name": "Jane Doe",
"email": "jane.doe@example.com",
"isActive": true,
"age": 29
}
2. Complex / Nested Data (E-commerce Order)
JSON
{
"orderId": "ORD-98765",
"createdAt": "2026-08-11T14:10:00Z",
"customer": {
"name": "Alex Smith",
"phone": "+1-555-0199"
},
"items": [
{
"sku": "KB-MEC-01",
"productName": "Mechanical Keyboard",
"quantity": 1,
"price": 89.99
},
{
"sku": "MS-WRL-02",
"productName": "Wireless Mouse",
"quantity": 2,
"price": 24.50
}
],
"shippingAddress": {
"street": "123 Market St",
"city": "Seattle",
"postalCode": "98101",
"country": "USA"
},
"notes": null
}
Common Uses of JSON
- Web APIs & REST Services: The standard format for data exchange between web browsers, mobile applications, and backend servers.
- Application Configuration: Used widely in configuration files (e.g.,
package.jsonfor Node.js,tsconfig.jsonfor TypeScript,settings.jsonin VS Code). - Document Databases: NoSQL databases like MongoDB (which uses BSON, a binary JSON variant), CouchDB, and PostgreSQL’s
jsonbtype store and query unstructured/semi-structured data directly in JSON-like formats. - Logging and Analytics: Modern logging systems (e.g., ELK Stack, Datadog) use structured JSON logs for easier searching, indexing, and filtering.
JSON అంటే ఏమిటి?
JSON అంటే JavaScript Object Notation. ఇది డేటాను ఒక సిస్టమ్ నుండి మరొక సిస్టమ్కు సులభంగా బదిలీ చేయడానికి ఉపయోగించే ఒక తేలికపాటి (lightweight), టెక్స్ట్ ఆధారిత ఫార్మాట్. ఇది మనుషులు చదవడానికి, రాయడానికి మరియు కంప్యూటర్లు ప్రాసెస్ చేయడానికి చాలా సులభంగా ఉంటుంది.
JSON అనేది జావాస్క్రిప్ట్ (JavaScript) సింటాక్స్ ఆధారంగా ప్రారంభమైనప్పటికీ, ఇది ఏ ఒక్క ప్రోగ్రామింగ్ లాంగ్వేజ్కు మాత్రమే పరిమితం కాదు (Language-Independent). పైథాన్ (Python), జావా (Java), సి# (C#), గో (Go), పిహెచ్పి (PHP) వంటి ఆధునిక ప్రోగ్రామింగ్ లాంగ్వేజ్లన్నీ JSONకు పూర్తి మద్దతును అందిస్తాయి.
JSON చరిత్ర (History)
- 2001: డగ్లస్ క్రాక్ఫోర్డ్ (Douglas Crockford) మరియు చిప్ మార్నింగ్స్టార్ (Chip Morningstar) సంక్లిష్టమైన XML ఫార్మాట్కు ప్రత్యామ్నాయంగా JSONను రూపొందించారు.
- 2002:
json.orgవెబ్సైట్ ప్రారంభమై, ఈ సింటాక్స్ ప్రపంచవ్యాప్తంగా డెవలపర్లకు అందుబాటులోకి వచ్చింది. - 2006: ఇంటర్నెట్ ఇంజనీరింగ్ టాస్క్ ఫోర్స్ (IETF) దీనిని ప్రామాణీకరిస్తూ RFC 4627ను విడుదల చేసింది. దీని అధికారిక మీడియా రకం (MIME type)
application/json. - 2013: JSON అంతర్జాతీయ ప్రమాణంగా ECMA-404 మరియు ఆ తర్వాత ISO/IEC 21778:2017 కింద గుర్తింపు పొందింది.
JSON సింటాక్స్ మరియు డేటా రకాలు (Data Types)
JSON ప్రాథమికంగా రెండు నిర్మాణాలపై ఆధారపడి ఉంటుంది:
- Objects: ఫ్లవర్ బ్రాకెట్స్
{}మధ్య ఉండే కీ-వాల్యూ (Key-Value) జతలు. ఇందులో ‘కీ’ (Key) ఎల్లప్పుడూ డబుల్ కోట్స్""లోనే ఉండాలి. - Arrays: స్క్వేర్ బ్రాకెట్స్
[]మధ్య వరుసగా అమర్చబడిన విలువల జాబితా.
సపోర్ట్ చేసే డేటా రకాలు
| డేటా రకం (Data Type) | వివరణ | ఉదాహరణ |
| String | డబుల్ కోట్స్లో ఉండే అక్షరాలు/వచనం | "Alice" |
| Number | పూర్ణాంకాలు లేదా దశాంశ సంఖ్యలు | 42, 3.14 |
| Boolean | నిజం లేదా అబద్ధం తెలిపే విలువలు | true లేదా false |
| Array | విలువల క్రమబద్ధమైన జాబితా | ["apple", "banana"] |
| Object | కీ/విలువలతో కూడిన ఉప-నిర్మాణం | {"city": "Hyderabad"} |
| Null | ఖాళీ లేదా ఏమీ లేని విలువ | null |
ఆచరణాత్మక ఉదాహరణలు (Practical Examples)
1. సాధారణ యూజర్ ప్రొఫైల్ (Simple User Profile)
JSON
{
"id": 101,
"name": "Jane Doe",
"email": "jane.doe@example.com",
"isActive": true,
"age": 29
}
2. క్లిష్టమైన / నెస్టెడ్ డేటా (E-commerce Order)
JSON
{
"orderId": "ORD-98765",
"createdAt": "2026-08-11T14:10:00Z",
"customer": {
"name": "Alex Smith",
"phone": "+1-555-0199"
},
"items": [
{
"sku": "KB-MEC-01",
"productName": "Mechanical Keyboard",
"quantity": 1,
"price": 89.99
},
{
"sku": "MS-WRL-02",
"productName": "Wireless Mouse",
"quantity": 2,
"price": 24.50
}
],
"shippingAddress": {
"street": "123 Market St",
"city": "Seattle",
"postalCode": "98101",
"country": "USA"
},
"notes": null
}
JSON ఉపయోగాలు (Uses)
- వెబ్ APIలు & REST సర్వీసెస్: వెబ్ బ్రౌజర్లు, మొబైల్ యాప్లు మరియు బ్యాకెండ్ సర్వర్ల మధ్య డేటాను వేగంగా మార్పిడి చేసుకోవడానికి ఇది అత్యంత ప్రామాణికమైన ఫార్మాట్.
- కాన్ఫిగరేషన్ ఫైల్స్: సాఫ్ట్వేర్ మరియు ప్రాజెక్ట్ సెట్టింగ్లను నిల్వ చేయడానికి విస్తృతంగా ఉపయోగిస్తారు (ఉదాహరణకు: Node.js లో
package.json, TypeScript లోtsconfig.json, VS Code లోsettings.json). - డాక్యుమెంట్ డేటాబేస్లు: NoSQL డేటాబేస్లైన MongoDB (ఇది BSON ఉపయోగిస్తుంది), CouchDB మరియు PostgreSQL లో డేటాను JSON రూపంలో నిల్వ చేయడానికి మరియు ప్రాసెస్ చేయడానికి ఉపయోగిస్తారు.
- లాగింగ్ మరియు అనలిటిక్స్: అప్లికేషన్ లాగ్లను సులభంగా శోధించడానికి, ఇండెక్స్ చేయడానికి modern logging టూల్స్ (ELK Stack, Datadog వంటివి) JSON ఫార్మాట్ను ఉపయోగిస్తాయి.
Complete Class Notes: Introduction to JSON
1. Overview & Fundamentals of Data Exchange
What is Communication Between Systems?
When two software systems need to interact (e.g., System A sending product data to System B), they exchange data using structured formats.
Common Data Formats
- Delimited Files: Comma-Separated (
.csv) or Tab-Separated (.tsv). - Configuration Files:
.ini,.properties(typically used for storing system configurations and user settings). - XML (Extensible Markup Language): Markup-based, highly structured, widely used for enterprise data interchange.
- JSON (JavaScript Object Notation): A lightweight, text-based data interchange format.
2. What is JSON?
- Full Form:JavaScript Object Notation.
- Core Definition: JSON is a data format used to represent, store, and exchange data over a network.
- Key Characteristics:
- Text-Based: Plain text containing no binary data, attachments, or images directly.
- Lightweight: Minimal syntax overhead leading to smaller file sizes.
- Human-Readable: Organized using key-value pairs and curly braces (
{ }), making it easy to read without complex parsers. - Language-Independent: Native support and pre-built parsing libraries exist across all major languages (Java, Python, C#, JavaScript, etc.).
3. Comparison: JSON vs. XML
| Feature | JSON | XML |
| Type | Data Interchange Format (Plain Text) | Markup Language |
| File Size | Lightweight (~40–50% smaller than XML) | Heavy (due to verbose open/close tags) |
| Parsing Speed | Faster, native to web technologies | Slower (requires DOM/SAX parsers) |
| Syntax Complexity | Simple (5–7 straightforward rules) | Strict (strict schemas, validation rules) |
| Namespaces & Comments | Not supported | Fully supported |
| Null Representation | Native null keyword ("field": null) | Empty tags (e.g., <color></color>) |
| Best Use Case | Web APIs (REST), Mobile/IoT apps, Modern Web | B2B integrations, EDI, Rosettanet, complex schemas |
Key Takeaways on Usage
- Choose JSON for: High performance, mobile/smart devices (e.g., smartwatches, smartphones), RESTful APIs, and modern web applications.
- Choose XML for: Legacy enterprise systems, complex B2B standards (like EDI, Rosettanet), and workflows requiring strict schema validation, namespaces, or inline comments.
4. Origin of the Name: JavaScript Object Literals vs. JSON
Why the Name?
JSON is named after JavaScript Object Literals because its syntax structure directly mirrors how objects are written in JavaScript.
Critical Distinction
- JavaScript: A client-side programming/scripting language executed in environments like web browsers.
- JSON: A passive, text-only data format used strictly for storing and transporting data.
Important: JSON and JavaScript are not the same, and JSON has no execution capabilities.
5. Syntax Comparison: JavaScript Object Literal vs. JSON
JavaScript Object Literal
JavaScript
// Defined inside JavaScript (.js or HTML <script>)
var product = {
productId: 101,
productName: "iPhone 8",
productPrice: 1000
};
// Accessing properties via dot notation
console.log(product.productId + " - " + product.productName + " - " + product.productPrice);
Corresponding JSON Representation
JSON
{
"productId": 101,
"productName": "iPhone 8",
"productPrice": 1000
}
Syntax Difference to Note
- In JavaScript Object Literals, keys do not strictly require quotation marks.
- In JSON, all keys (field names) and string values must be enclosed in double quotes (
" ").
6. Summary Checklist
- JSON stands for JavaScript Object Notation.
- JSON is a data format, not a programming language.
- It is lightweight, human-readable, and platform-independent.
- It replaced XML in most modern web and mobile applications due to reduced payload size and faster execution.
పూర్తి క్లాస్ నోట్స్: JSON పరిచయం (Introduction to JSON)
1. స్థూల అవలోకనం & సిస్టమ్ల మధ్య డేటా మార్పిడి (Overview & Fundamentals of Data Exchange)
సిస్టమ్ల మధ్య కమ్యూనికేషన్ అంటే ఏమిటి?
రెండు సాఫ్ట్వేర్ సిస్టమ్లు పరస్పరం సంభాషించుకోవాల్సినప్పుడు (ఉదాహరణకు, System A ప్రాడక్ట్ డేటాను System Bకి పంపడం), అవి నిర్మాణాత్మక ఫార్మాట్లను (structured formats) ఉపయోగించి డేటాను మార్పిడి చేసుకుంటాయి.
సాధారణ డేటా ఫార్మాట్లు:
- డీలిమిటెడ్ ఫైళ్లు (Delimited Files): కామాతో వేరుచేసినవి (
.csv) లేదా ట్యాబ్తో వేరుచేసినవి (.tsv). - కాన్ఫిగరేషన్ ఫైళ్లు (Configuration Files):
.ini,.properties(సిస్టమ్ కాన్ఫిగరేషన్లు మరియు యూజర్ సెట్టింగ్లను భద్రపరచడానికి ఉపయోగిస్తారు). - XML (Extensible Markup Language): మార్కప్ ఆధారితమైనది, అత్యంత నిర్మాణాత్మకమైనది, ఎంటర్ప్రైజ్ స్థాయి డేటా మార్పిడికి విస్తృతంగా ఉపయోగించబడుతుంది.
- JSON (JavaScript Object Notation): తేలికైన (lightweight), టెక్స్ట్ ఆధారిత డేటా మార్పిడి ఫార్మాట్.
2. JSON అంటే ఏమిటి?
- పూర్తి రూపం:JavaScript Object Notation.
- ముఖ్య నిర్వచనం: JSON అనేది నెట్వర్క్ ద్వారా డేటాను సూచించడానికి, భద్రపరచడానికి మరియు మార్పిడి చేసుకోవడానికి ఉపయోగించే ఒక డేటా ఫార్మాట్.
- ముఖ్య లక్షణాలు:
- టెక్స్ట్ ఆధారితం (Text-Based): సాధారణ టెక్స్ట్ను కలిగి ఉంటుంది; ఇమేజ్లు లేదా బైనరీ ఫైళ్ల వంటి ఆడంబరాలు ఉండవు.
- లైట్వెయిట్ (Lightweight): తక్కువ సింటాక్స్ నియమాలు ఉండటం వల్ల ఫైల్ పరిమాణం చాలా చిన్నదిగా ఉంటుంది.
- హ్యూమన్-రీడబుల్ (Human-Readable): కీ-వ్యాల్యూ జంటలు (key-value pairs) మరియు కర్లీ బ్రాకెట్లతో (
{ }) అమర్చబడి ఉండటం వల్ల మనుషులు సులభంగా చదివి అర్థం చేసుకోగలరు. - లాంగ్వేజ్-స్వతంత్రమైనది (Language-Independent): దాదాపు అన్ని ప్రముఖ ప్రోగ్రామింగ్ భాషలలో (Java, Python, C#, JavaScript మొదలైనవి) JSONను చదవడానికి ముందే రూపొందించిన లైబ్రరీలు అందుబాటులో ఉన్నాయి.
3. పోలిక: JSON వర్సెస్ XML (JSON vs. XML)
| ఫీచర్ | JSON | XML |
| రకం (Type) | డేటా ఇంటర్చేంజ్ ఫార్మాట్ (ప్లెయిన్ టెక్స్ట్) | మార్కప్ లాంగ్వేజ్ |
| ఫైల్ పరిమాణం (File Size) | తేలికైనది (XML కంటే దాదాపు 40–50% చిన్నది) | పెద్దది (ఓపెనింగ్, క్లోజింగ్ ట్యాగ్ల వల్ల పరిమాణం ఎక్కువ) |
| ప్రాసెసింగ్ వేగం (Parsing Speed) | వేగవంతమైనది, వెబ్ టెక్నాలజీలలో సహజంగా పనిచేస్తుంది | నెమ్మదిగా ఉంటుంది (DOM/SAX పార్సర్లు అవసరం) |
| సింటాక్స్ సంక్లిష్టత | చాలా సరళమైనది (5 నుండి 7 సులభమైన నియమాలు) | కఠినమైనది (కఠినమైన స్కీమాలు, ధృవీకరణ నియమాలు ఉంటాయి) |
| నేమ్స్పేస్లు & కామెంట్లు | సపోర్ట్ చేయదు | పూర్తిగా సపోర్ట్ చేస్తుంది |
| Null ప్రాతినిధ్యం | నేరుగా null కీవర్డ్ను ఉపయోగిస్తుంది ("రంగు": null) | ఖాళీ ట్యాగ్ల ద్వారా సూచిస్తారు (ఉదా: <color></color>) |
| ఉత్తమ వినియోగం | వెబ్ APIలు (REST), మొబైల్/IoT యాప్లు, ఆధునిక వెబ్ | B2B అనుసంధానాలు, EDI, Rosettanet, క్లిష్టమైన స్కీమాలు |
వినియోగానికి సంబంధించిన ముఖ్య గమనికలు:
- JSON ఎప్పుడు ఎంచుకోవాలి: అధిక వేగం, మొబైల్/స్మార్ట్ పరికరాలు (స్మార్ట్వాచ్లు, స్మార్ట్ఫోన్లు), RESTful APIలు మరియు ఆధునిక వెబ్ అప్లికేషన్ల కోసం.
- XML ఎప్పుడు ఎంచుకోవాలి: లెగసీ ఎంటర్ప్రైజ్ సిస్టమ్లు, క్లిష్టమైన B2B ప్రమాణాలు (EDI, Rosettanet వంటివి), మరియు కఠినమైన స్కీమా ధృవీకరణ, నేమ్స్పేస్లు లేదా కామెంట్లు అవసరమైనప్పుడు.
4. పేరు వెనుక నేపథ్యం: JavaScript Object Literals వర్సెస్ JSON
JSON అనే పేరు ఎందుకు వచ్చింది?
JavaScriptలో ఆబ్జెక్ట్లను రాసే విధానాన్ని (JavaScript Object Literals) ఈ సింటాక్స్ నేరుగా పోలి ఉండటం వల్ల దీనికి JavaScript Object Notation అనే పేరు వచ్చింది.
ముఖ్యమైన తేడా:
- JavaScript: ఇది వెబ్ బ్రౌజర్లలో ఎగ్జిక్యూట్ అయ్యే క్లయింట్-సైడ్ ప్రోగ్రామింగ్/స్క్రిప్టింగ్ లాంగ్వేజ్.
- JSON: ఇది కేవలం డేటాను స్టోర్ చేయడానికి మరియు రవాణా చేయడానికి ఉపయోగపడే పాసివ్, టెక్స్ట్ ఆధారిత డేటా ఫార్మాట్.
ముఖ్య గమనిక: JSON మరియు JavaScript ఒకటి కావు; JSONకి కోడ్ను ఎగ్జిక్యూట్ చేసే సామర్థ్యం ఉండదు.
5. సింటాక్స్ పోలిక: JavaScript Object Literal వర్సెస్ JSON
JavaScript Object Literal
JavaScript
// JavaScriptలో నిర్వచించే విధానం (.js లేదా HTML <script> లోపల)
var product = {
productId: 101,
productName: "iPhone 8",
productPrice: 1000
};
// డాట్ నోటేషన్ ద్వారా ప్రాపర్టీలను యాక్సెస్ చేయడం
console.log(product.productId + " - " + product.productName + " - " + product.productPrice);
దానికి సంబంధించిన JSON ప్రాతినిధ్యం
JSON
{
"productId": 101,
"productName": "iPhone 8",
"productPrice": 1000
}
గమనించవలసిన సింటాక్స్ తేడా:
- JavaScript Object Literals లో కీలకు (keys) కొటేషన్ మార్కులు తప్పనిసరి కాదు.
- JSON లో అన్ని కీలు (ఫీల్డ్ పేర్లు) మరియు స్ట్రింగ్ విలువలు తప్పనిసరిగా డబుల్ కోట్స్ (
" ") లోపలే ఉండాలి.
6. సారాంశం (Summary Checklist)
- JSON అంటే JavaScript Object Notation.
- JSON అనేది ఒక డేటా ఫార్మాట్, ప్రోగ్రామింగ్ లాంగ్వేజ్ కాదు.
- ఇది తేలికైనది (lightweight), చదవడానికి సులభమైనది (human-readable) మరియు ఏ ప్రోగ్రామింగ్ లాంగ్వేజ్ పైన ఆధారపడనిది (platform-independent).
- తక్కువ ఫైల్ సైజు మరియు వేగవంతమైన ప్రాసెసింగ్ సామర్థ్యం కారణంగా ఆధునిక వెబ్ మరియు మొబైల్ అప్లికేషన్లలో ఇది XML స్థానాన్ని భర్తీ చేసింది.