Master data formats and parsing functions with detailed examples
JSON 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 the most widely used format for web APIs, mobile app communication, and software configuration files.
{
"name": "Rahul Kumar",
"age": 28,
"isStudent": false,
"skills": ["JavaScript", "Python", "React"],
"address": {
"city": "Mumbai",
"state": "Maharashtra",
"pincode": 400001
},
"projects": [
{
"title": "E-commerce Website",
"status": "completed",
"year": 2023
},
{
"title": "Mobile App",
"status": "in-progress",
"year": 2024
}
]
}
XML is a markup language used to store data in a structured and hierarchical format. It uses tags that look similar to HTML, but it allows you to create your own custom tags.
<?xml version="1.0" encoding="UTF-8"?>
<employee>
<name>Rahul Kumar</name>
<age>28</age>
<department id="IT-001">
<name>Information Technology</name>
<location>Mumbai</location>
</department>
<skills>
<skill level="expert">JavaScript</skill>
<skill level="intermediate">Python</skill>
<skill level="expert">React</skill>
</skills>
<projects>
<project status="completed">
<title>E-commerce Website</title>
<year>2023</year>
</project>
</projects>
</employee>
YAML is a human-friendly data serialization format that is widely used for configuration files. It uses indentation to define structure, so there is no need for brackets or braces.
# symbol.# Employee Configuration
name: Rahul Kumar
age: 28
isStudent: false
# Skills List
skills:
- JavaScript
- Python
- React
# Nested Address Object
address:
city: Mumbai
state: Maharashtra
pincode: 400001
# Array of Objects
projects:
- title: E-commerce Website
status: completed
year: 2023
technologies:
- React
- Node.js
- MongoDB
- title: Mobile App
status: in-progress
year: 2024
technologies:
- React Native
- Firebase
TOML is a configuration file format inspired by INI files. It is human-readable and designed to be easy and unambiguous to parse. TOML is very popular in Rust and Python projects.
# symbol.# Employee Configuration File name = "Rahul Kumar" age = 28 isStudent = false # Skills Array skills = ["JavaScript", "Python", "React"] # Address Table [address] city = "Mumbai" state = "Maharashtra" pincode = 400001 # Array of Tables - Projects [[projects]] title = "E-commerce Website" status = "completed" year = 2023 technologies = ["React", "Node.js", "MongoDB"] [[projects]] title = "Mobile App" status = "in-progress" year = 2024 technologies = ["React Native", "Firebase"] # Nested Table Example [database] server = "192.168.1.1" port = 5432 connection_max = 5000 enabled = true [database.credentials] username = "admin" password = "secure_password"
The Format function converts data into a human-readable format. It adds proper indentation and line breaks to make the code easy to read.
Converts minified or unformatted data into a properly indented and readable format.
{"name":"Rahul","age":28,"skills":["JS","Python"],"address":{"city":"Mumbai"}}
{
"name": "Rahul",
"age": 28,
"skills": [
"JS",
"Python"
],
"address": {
"city": "Mumbai"
}
}
The Minify function compresses data by removing unnecessary whitespace, line breaks, and indentation. This reduces the file size and helps in faster network transfer.
Reduces file size to improve loading speed and minimize bandwidth usage.
{
"name": "Rahul Kumar",
"age": 28,
"skills": [
"JavaScript",
"Python",
"React"
]
}
{"name":"Rahul Kumar","age":28,"skills":["JavaScript","Python","React"]}
The Repair function fixes broken or invalid data. It automatically detects and corrects common syntax errors.
Converts data with invalid syntax into a valid format.
{
"name": "Rahul"
"age": 28
"city": "Mumbai"
}
{
"name": "Rahul",
"age": 28,
"city": "Mumbai"
}
{'name': 'Rahul', 'age': 28}
{"name": "Rahul", "age": 28}
The Sort function arranges data keys in alphabetical order. This helps keep the data organized and makes it easier to compare.
Organizes data by sorting keys in alphabetical order.
{
"name": "Rahul",
"city": "Mumbai",
"age": 28,
"email": "rahul@example.com",
"country": "India"
}
{
"age": 28,
"city": "Mumbai",
"country": "India",
"email": "rahul@example.com",
"name": "Rahul"
}
Our tool seamlessly transforms JSON structures into valid XML documents. During this process, JSON objects are mapped to XML elements, while arrays are converted into repeated child nodes to maintain data integrity.
{
"employee": {
"name": "Rahul",
"age": 28,
"skills": ["JavaScript", "Python"]
}
}
<employee> <name>Rahul</name> <age>28</age> <skills>JavaScript</skills> <skills>Python</skills> </employee>
Converts XML data into JSON format. XML elements are converted into objects, and repeated elements are converted into arrays.
<person> <name>Rahul</name> <age>28</age> </person>
{
"person": {
"name": "Rahul",
"age": "28"
}
}
Converts JSON data into YAML using a clean and human-friendly syntax. This makes configuration files easier to read and maintain.
Converts JSON into YAML for better readability and simpler configuration management.
{"name": "Rahul", "age": 28, "skills": ["JS", "Python"]}
name: Rahul age: 28 skills: - JS - Python
Converts JSON data into the TOML configuration format. This is useful for projects that use TOML-based configuration files.
Converts JSON into TOML for clean, readable, and strongly typed configuration files.
{
"database": {
"server": "localhost",
"port": 5432
}
}
[database] server = "localhost" port = 5432
Converts XML data into YAML format, making it easier to read and understand.
Converts XML into YAML for better readability and cleaner configuration files.
XML Input:
<user>
<name>Keshav</name>
<skills>Java</skills>
<skills>Spring</skills>
</user>
YAML Output:
user:
name: Keshav
skills:
- Java
- Spring
Converts XML configuration into TOML format for modern build tools.