ADBMS Exp3
ADBMS Exp3
Theory :
What is json :
JSON, or JavaScript Object Notation, is a text-based format for storing and exchanging data. It's a popular choice for web
developers because it's easy to read and understand, and it's language-independent.JSON is text-based and uses a syntax that is
derived from JavaScript object notation, which makes it readable by humans. JSON, or JavaScript Object Notation, is a
lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is
often used to transmit data between a server and a web application as an alternative to XML.
Features of json :
➢ Simplicity
➢ Openness
➢ Self describing
➢ Extensibility
➢ Interoperability
Why do we use json :
1. Human-Readable Format
JSON is easy to read and understand, making it accessible for developers and non-developers alike. Its clear structure helps in
quickly identifying data elements.
2. Lightweight Data Interchange
JSON has a minimalistic syntax, resulting in smaller data payloads compared to formats like XML. This reduces the amount of
data transferred over networks, improving performance and speed.
3. Ease of Parsing
JSON can be easily parsed and generated by programming languages. Most languages provide built-in libraries or functions for
handling JSON, making it straightforward to work with.
4. Hierarchical Structure
JSON supports nested structures, allowing for complex data representation. This is useful for representing relationships, such as
an object containing other objects or arrays.
5. Compatibility with JavaScript
JSON is natively supported by JavaScript, which is the primary language for web development. JavaScript can directly parse
and manipulate JSON data using JSON.parse() and JSON.stringify(), facilitating seamless integration.
Json data types :
Difference between json and xml :
Json Xml
A way of representing objects A markup language that uses tag structure to represent data
items
Program :
{
"company": {
"employees": [
{
"employeeNo": "E001",
"firstName": "Purva",
"lastName": "Jage",
"contactNo": "123-456-7890",
"email": "[email protected]",
"address": {
"city": "New panvel",
"state": "Maharashtra",
"zip": "410204"
}
},
{
"employeeNo": "E002",
"firstName": "Chirag",
"lastName": "Wadkar",
"contactNo": "987-654-3210",
"email": "[email protected]",
"address": {
"city": "Marine drive",
"state": "Mumbai",
"zip": "90001"
}
},
{
"employeeNo": "E003",
"firstName": "Umair",
"lastName": "Momin",
"contactNo": "555-123-4567",
"email": "[email protected]",
"address": {
"city": "Seewods",
"state": "maharashtra",
"zip": "410204"
}
},
{
"employeeNo": "E004",
"firstName": "Mrunal",
"lastName": "deshpande",
"contactNo": "444-567-8901",
"email": "[email protected]",
"address": {
"city": "badlapur",
"state": "maharastra",
"zip": "410204"
}
},
{
"employeeNo": "E005",
"firstName": "jiya",
"lastName": "singh",
"contactNo": "222-333-4444",
"email": "[email protected]",
"address": {
"city": "kharghar",
"state": "Maharashtra",
"zip": "33101"
}
}
]
}
}
output :
Conclusion : Hence we learned to execute json on an online compiler.