NoSQL JSON Manager
NoSQL JSON Manager
In the modern digital era, computers have become an indispensable part of our daily lives,
providing us with swift, reliable, and accurate solutions to a multitude of tasks. With just a few
clicks, we can access a wealth of information and perform complex operations effortlessly. The
speed and precision of computers make them a powerful tool across various domains, including
data management and processing, which are essential in today’s fast-paced business
environment.
The project I have undertaken falls into this dynamic sphere, aiming to streamline data handling
through the use of advanced technology. Specifically, it focuses on the efficient management of
JSON data, a vital aspect of modern web applications and data-driven solutions.
The NoSQL JSON Manager project leverages the capabilities of computers to offer users a
powerful platform for storing, retrieving, and manipulating data with ease and flexibility.
By utilizing Flask as the backend framework and incorporating RESTful APIs, this project
provides a robust system for managing data. The user interface, built with HTML, CSS, and
JavaScript, ensures a seamless and intuitive experience, enabling users to perform CRUD
operations on JSON data efficiently.
This project embodies the principles of NoSQL databases, emphasizing schema-less, flexible
data structures that adapt to evolving needs, making it a valuable tool for developers and data
analysts alike.
Objectives:
• To develop a web application that mimics NoSQL database functionalities using JSON as the data
format.
• To implement REST API endpoints for seamless data manipulation.
• To create a user-friendly interface for managing JSON data.
Scope:
• Suitable for developers and data analysts who need a lightweight NoSQL solution for managing
JSON data.
• Ideal for applications requiring flexible, schema-less data storage.
Key Features:
1. NoSQL Data Management:
o Schema-less storage with JSON, allowing dynamic and flexible data structures.
2. RESTful CRUD Operations:
o Create: Add new JSON entries through REST API POST requests.
o Read: Fetch all or specific JSON entries using GET requests.
o Update: Modify existing JSON entries with PUT requests.
o Delete: Remove unwanted entries using DELETE requests.
3. Flask Routing:
o Utilizes Flask’s routing capabilities to define RESTful endpoints.
4. User Interface:
o Built with HTML, CSS, and JavaScript to provide a responsive and interactive experience.
Technology Stack:
• Backend: Flask (Python framework) for routing and RESTful API implementation.
• Frontend: HTML, CSS, JavaScript for the UI.
• Data Storage: JSON for flexible, schema-less data management.
Expected Outcomes:
• A web application that acts as a lightweight NoSQL database using JSON and Flask.
• Enhanced data management capabilities with a user-friendly interface.
• Efficient handling of dynamic and complex data structures without predefined schemas.
Flask
Flask is the chosen web framework for the backend
development of NoSQL JSON Manager. It is a
lightweight and flexible framework that provides
the essential components needed to build web
applications. Flask supports modular code
development, making it easier to manage routes,
handle requests, and develop RESTful APIs. Its
minimalistic nature allows developers to add only the necessary extensions, resulting in a clean and
efficient codebase. Flask is ideal for creating scalable web applications with dynamic content.
HTML5
HTML5 is used to structure the web pages of NoSQL JSON Manager. As the
backbone of the frontend, HTML5 defines the layout and content of the
application, including forms, buttons, and interactive elements. It
supports multimedia content, semantic elements, and improved
accessibility features, making the web application more user-friendly
and functional. HTML5 ensures that the application is well-structured
and compatible with modern web standards.
CSS3
CSS3 is responsible for the styling and layout of NoSQL JSON Manager. It enhances the visual appeal of
the application by applying styles to HTML elements,
enabling responsive design, and creating visually engaging
user interfaces. CSS3 introduces advanced features such as
flexbox, grid layouts, and animations, which help in building
a modern, attractive, and intuitive frontend. With CSS3, the
application can adapt to various screen sizes and devices,
ensuring a consistent user experience.
It enables real-time updates, client-side validations, and asynchronous communication with the server
through AJAX. JavaScript enhances the user experience by allowing smooth transitions, interactive
forms, and immediate feedback without the need for page reloads. Its integration with HTML and CSS
makes it a powerful tool for creating engaging and responsive web applications.
JSON
JSON (JavaScript Object Notation) is the data format used for storing and
exchanging information in NoSQL JSON Manager. Its lightweight and human-
readable structure make it ideal for data serialization and deserialization. JSON's
schema-less nature allows for flexible and dynamic data storage, which aligns
with the principles of NoSQL databases. This flexibility simplifies data
manipulation and integration with web APIs, ensuring efficient data handling
within the application.
REST API
REST API (Representational State Transfer) is employed in NoSQL JSON
Manager to enable communication between the client and server. The
RESTful architecture ensures stateless, scalable, and modular interactions
through standardized HTTP methods (GET, POST, PUT, DELETE). This
design allows the application to perform CRUD operations on JSON data,
providing a structured approach to data management. REST APIs facilitate
seamless integration with other web services, enhancing the overall
functionality of the application.
data requirements, making it suitable for applications with dynamic and unstructured data. NoSQL
principles ensure that the application can handle large volumes of data with high performance and
reliability.
The primary objective is to create an intuitive web application that helps developers and data analysts
manage JSON data efficiently. By leveraging JSON’s flexibility, the app enables users to store and
manipulate semi-structured or unstructured data, making it suitable for scenarios where data formats
may evolve dynamically.
Another key goal is to implement REST API endpoints that allow seamless interaction with data. Through
standard HTTP methods (POST, GET, PUT, DELETE), users can perform CRUD operations, ensuring
efficiency and scalability. The RESTful architecture allows the application to handle various use cases
effectively.
The project also focuses on building a user-friendly interface, making it accessible to both technical
and non-technical users. The interface will simplify JSON data management, ensuring a seamless
experience for all users.
Ultimately, the NoSQL JSON Manager aims to provide a scalable, flexible solution for real-time data
manipulation, supporting a wide range of use cases. By combining the power of NoSQL databases, JSON,
and REST APIs, the application offers a modern tool to manage dynamic and schema-less data in an
efficient, user-friendly environment.
To enhance security and control access to the application, authentication mechanisms will be
implemented. Users will authenticate using private keys or API keys to ensure secure access to data and
endpoints. Only authorized users will be able to perform CRUD operations, protecting sensitive data from
unauthorized access. Additionally, security rules will be implemented to define permissions, allowing for
role-based access to specific data, and ensuring that users can only interact with data they are
authorized to access.
In addition, the user-friendly interface ensures that both technical and non-technical users can interact
with the application efficiently. The NoSQL JSON Manager aims to bridge the gap between traditional
databases and modern, dynamic data management needs.
Schema-less Storage with JSON: NoSQL JSON Manager leverages JSON (JavaScript Object
Notation) for its data storage, embracing the schema-less nature of NoSQL databases. This
flexibility allows users to store data without the constraints of predefined schemas, making it
possible to handle varied and complex data structures. Users can easily adapt their data models
to meet evolving requirements without the need for costly and time-consuming database
migrations. This dynamic storage approach is particularly useful for applications dealing with
unstructured or semi-structured data, enabling seamless integration and rapid development.
Create: The Create operation is facilitated through REST API POST requests, allowing users to
add new entries to the JSON data store. This feature ensures that users can dynamically expand
their data collection by simply sending structured JSON payloads to the designated API
endpoint. The POST requests are designed to validate and process incoming data, ensuring
consistency and integrity within the data store.
Read: Fetching data is streamlined through GET requests, which allow users to retrieve either
all entries or specific records based on query parameters. This functionality provides flexibility
in accessing data, whether for display purposes, data analysis, or integration with other
systems. The GET endpoints are optimized to handle various filters and parameters, ensuring
efficient data retrieval and minimal server load.
Update and Delete via POST and GET: In NoSQL JSON Manager, both update and delete
operations are handled through POST and GET requests, rather than using the traditional PUT
and DELETE methods. This approach simplifies the routing logic and ensures consistent handling
of all operations. Users can send specific instructions within the POST or GET requests to
indicate whether an entry should be updated or deleted. This method maintains a unified API
structure while still allowing for the full range of CRUD functionalities.
3. Flask Routing :
Utilizes Flask’s Routing Capabilities: Flask, a lightweight and flexible Python web framework,
forms the backbone of NoSQL JSON Manager's server-side logic. Its routing capabilities are
harnessed to define RESTful endpoints for all CRUD operations. Each endpoint is carefully
mapped to a specific function, ensuring clear and maintainable code structure. Flask’s routing
allows for the easy handling of URL parameters, query strings, and request payloads, enabling
the creation of a fully functional API with minimal boilerplate code.
Flask’s modular nature allows developers to organize their code into blueprints and modules,
enhancing maintainability and scalability. This structure is particularly beneficial for projects
that may grow in complexity over time, ensuring that new features and endpoints can be added
without disrupting existing functionality.
Built with HTML, CSS, and JavaScript: The user interface of NoSQL JSON Manager is designed
to provide a responsive and interactive experience, built using HTML, CSS, and JavaScript. HTML
serves as the structural foundation, defining the layout and elements of the web pages. CSS is
utilized to style the interface, ensuring a visually appealing and consistent look across different
devices and screen sizes. CSS techniques like flexbox and grid layouts are employed to create
responsive designs that adapt to varying viewports, enhancing usability.
JavaScript plays a pivotal role in adding interactivity and dynamic functionality to the interface.
It enables features such as real-time data updates, form validations, and asynchronous requests
(AJAX) to the server, providing a smooth and efficient user experience. The integration of
JavaScript with RESTful APIs allows users to perform CRUD operations directly from the
frontend, with immediate feedback and updates displayed on the interface.
The combination of these technologies ensures that the user interface is not only functional but
also engaging and user-friendly. The design prioritizes ease of use, enabling users to navigate
the application and manage data effortlessly, whether they are adding new entries, fetching
existing records, or modifying and deleting data.
3. Reset Data:
o Resets the entire data store to its initial state.
o Saves the reset data and returns a confirmation message.
- Initialization Process
• Start Application: Checks if database.json exists; if not, creates an empty database.
• Load JSON: Loads existing JSON data for processing.
• Save JSON: Saves any updates or changes back to database.json.
- User Interface
• Home Route: Serves the main webpage, rendering index.html with the data from the
JSON store.
• Render Template: Displays the user interface, populated with data from the backend.
The NoSQL JSON Manager provides a robust system for managing JSON data using a schema-less
NoSQL approach. The DFD illustrates how data flows between various components, ensuring
efficient data management and user interaction. By utilizing Flask for routing and RESTful APIs
for data operations, the system offers a seamless experience for dynamic data handling, making
it a powerful tool for modern web applications.
2. Route
• Attributes:
o endpoint: The API path that defines a specific route.
o method: Specifies the HTTP method (GET or POST) used for the route.
o subpath: Optional parameter for additional path details.
• Relationships:
o Each Route is associated with one Handler.
3. Handler
• Attributes:
o operation: Describes the type of operation performed (e.g., set, get, append,
remove).
o response_type: Specifies the response format, typically JSON.
o status_code: HTTP status code returned by the handler.
• Relationships:
o Each Handler interacts with one or more Database entities to perform the required
operations.
4. Database
• Attributes:
o filename: Name of the JSON file used as the database (e.g., database.json).
o root_node: The root node of the JSON structure.
o format: Specifies the format of the stored data, which is JSON.
• Relationships:
o The Database interacts with JSONPath to navigate and manipulate the JSON data
structure.
6. Value
• Attributes:
o data: Contains any JSON value (e.g., objects, arrays, or primitives).
o type: Indicates the type of data (e.g., dictionary, list, or primitive types like string
or number).
• Relationships:
o Each Value is associated with a JSONPath to signify the exact data located at a
specific path within the JSON structure.
Summary:
The ER diagram highlights a structured and modular approach to handling JSON-based NoSQL
data. The application leverages Flask for routing, with clearly defined handlers for CRUD
operations. The database interactions rely on JSONPath for efficient data manipulation, and the
values are dynamically stored and retrieved, reflecting the flexibility of the NoSQL paradigm.
This structure ensures a robust, scalable, and maintainable system for managing JSON data
through RESTful APIs.
processes
Application
Handler
str ing name Flask App
str ing oper ation set get append r emove
str ing static_dir static/
str ing r esponse_type JSON
str ing template_dir templates/
int status_code HTTP status
str ing main_file main.py
manages interacts
Database
str ing filename database.json
contains
JSONPath
str ing path nested/path/str uctur e
stores
Value
object data Any JSON value
System Implementation
The system implementation can be divided into three main components: the backend, the frontend, and
data handling mechanisms.
Backend Implementation:
• Flask App Setup:
The backend was implemented using Flask, which provides routing, request handling, and data
processing capabilities. Each route corresponds to a specific operation on the JSON data, such as
retrieving all data, setting a value, or appending data.
• Data Management Functions:
Custom functions were developed to load and save data from the database.json file. These
functions ensure data consistency and integrity by handling file I/O operations securely and
efficiently.
• Path-Based Data Access:
Data is accessed and manipulated using path-based keys, allowing users to specify nested data
structures directly. This feature is crucial for working with complex JSON objects.
Frontend Implementation:
• HTML Template:
A single HTML template (index.html) was designed to display the database content and provide
user controls for performing various operations. The template includes placeholders for dynamic
content, which is populated using data fetched from the backend.
• CSS Styling:
Custom CSS, supported by Bootstrap, was used to style the application. The goal was to create a
clean and user-friendly interface with a focus on readability and ease of navigation.
• JavaScript Interactivity:
JavaScript functions were added to handle user interactions, such as form submissions and
dynamic content updates. These functions make asynchronous requests to the backend and
update the UI based on the response.
Data Handling:
• JSON File Operations:
The database.json file serves as the app’s data store. The backend functions handle reading from
and writing to this file, ensuring data is stored persistently and retrieved accurately.
• Data Integrity Checks:
Validation and error handling mechanisms are in place to ensure the integrity of the data. For
example, when setting or appending data, the app checks for valid JSON structures and handles
errors gracefully, providing meaningful feedback to the user.
save_json(data)
return jsonify({"message": f"Data set at {subpath}!"}),
201
save_json(data)
return jsonify({"message": f"Data appended at
{subpath}!"}), 201
if keys[-1] in target_data:
del target_data[keys[-1]]
save_json(data)
return jsonify({"message": f"Data removed from
{subpath}!"}), 200
else:
return jsonify({"error": f"{subpath} not found!"}),
404
app.py - The main Flask app entry point that handles routing and initializes the app
database.json - The JSON file acting as a simple document store/database
Frontend-related directories:
+---static
| style.css
|
\---templates
index.html
Installation Instructions:
To set up the environment, use the following commands to install the necessary dependencies:
This will install the Flask and Request library, which is required to run the web application. The project
also uses standard Python libraries (like json and os), which are available by default in Python 3.x, so no
additional installation is necessary for those.
Additional requirements include the ability to manage nested data structures (dictionaries and lists)
within the JSON file, and the capacity to validate data integrity during API operations. The application
should be able to handle edge cases such as non-existent paths and invalid data types, providing clear
error responses for failed operations.
This will launch the Flask web server, usually accessible at http://127.0.0.1:5000/.
You can send a POST request with a JSON body specifying the value you want to set.
▪ POST /api/data/append/<path>: Appends data to a specific path in the database.
You can send a POST request to add data to lists or merge dictionaries.
▪ POST /api/data/remove/<path>: Removes data from the specified path.
▪ POST /api/data/reset: Resets the database to its initial state.
- append.py
import requests
url = 'http://127.0.0.1:5000/api/data/append/nosql@db/users'
payload = {
"value": {
"User1": {"name": "John Doe", "age": 32},
"User2": {"name": "Peter Doe", "age": 12}
}
}
- setonly.py
import requests
url = 'http://127.0.0.1:5000/api/data/set/nosql@db/users/User1/name'
payload = {"value": "Sam Doe"}
#Output
>> {'message': 'Data set at nosql@db/users/User1/name!'}
# database affected
{
"nosql@db": {
"users": {
"User1": {
"name": "Sam Doe",
"age": 32
},
"User2": {
"name": "Peter Doe",
"age": 12
}
}
}
}
- getall.py
import requests
response = requests.get('http://127.0.0.1:5000/api/data')
print(response.json())
#Output
>>{'nosql@db': {'users': {'User1': {'age': 32, 'name': 'Sam Doe'}, 'User2':
{'age': 12, 'name': 'Peter Doe'}}}}
response =
requests.get('http://127.0.0.1:5000/api/data/get/nosql@db/users/User1')
print(response.json()) # This will print the value at the path "some/key"
#Output
>> {'age': 32, 'name': 'Sam Doe'}
- rem.py
import requests
url = 'http://127.0.0.1:5000/api/data/remove/nosql@db/users/User1/name'
# Provide the correct path for the selected field or node
payload = {} # No need to send a value, just the endpoint for removal
#Output
>> {'message': 'Data removed from nosql@db/users/User1/name!'}
#database affected
{
"nosql@db": {
"users": {
"User1": {
"age": 32
},
"User2": {
"name": "Peter Doe",
"age": 12
}
}
}
}
- reset.py
import requests
response = requests.post('http://127.0.0.1:5000/api/data/reset')
print(response.json())
# Expected output: {"message": "Database reset!"}
#Output
{'message': 'Database reset!'}
#database affected
{
"nosql@db": {}
}
- Flask Initialization
app = Flask(__name__)
- Load JSON
# Load JSON data from the file
def load_json():
if not os.path.exists("database.json"):
# If database.json doesn't exist, create an empty database
save_json({"nosql@db":{}})
with open("database.json", "r") as file:
return json.load(file)
- Save JSON
# Save JSON data to the file
def save_json(data):
with open("database.json", "w") as file:
json.dump(data, file, indent=4)
if isinstance(target_data, list):
# Append to a list
target_data.append(value)
elif isinstance(target_data, dict):
# If the target data is a dict and the last key exists, update it
key = keys[-1]
if key in target_data:
# If it's an existing dictionary, merge the data
target_data[key].update(value)
else:
# If it's a new key, add the new value
target_data[key] = value
else:
return {"error": f"Cannot append data at {path}, target is neither a
list nor a dict!"}
- App Routes
@app.route('/')
def home():
data = load_json()
return render_template('index.html', data=data)
@app.route('/api/data', methods=['GET'])
def print_data():
data = load_json()
return jsonify(data)
@app.route('/api/data/set/<path:subpath>', methods=['POST'])
def set_data(subpath):
new_data = request.get_json() # Get data from the POST request
value = new_data.get("value", {})
data = load_json()
save_json(data)
return jsonify({"message": f"Data set at {subpath}!"}), 201
@app.route('/api/data/append/<path:subpath>', methods=['POST'])
def append_data(subpath):
new_data = request.get_json() # Get data from the POST request
value = new_data.get("value", {})
data = load_json()
save_json(data)
return jsonify({"message": f"Data appended at {subpath}!"}), 201
@app.route('/api/data/get/<path:subpath>', methods=['GET'])
def get_data(subpath):
data = load_json()
keys = subpath.split('/')
for key in keys:
if key in data:
data = data[key]
else:
return jsonify({"error": f"{subpath} not found!"}), 404
return jsonify(data), 200
@app.route('/api/data/remove/<path:subpath>', methods=['POST'])
def remove_data(subpath):
data = load_json()
keys = subpath.split('/')
target_data = data
for key in keys[:-1]:
if key in target_data:
target_data = target_data[key]
else:
return jsonify({"error": f"{subpath} not found!"}), 404
- App Execution
if __name__ == '__main__':
app.run(debug=True)
</head>
<body>
<div class="container">
<header>
<h1>NoSQL JSON Manager</h1>
</header>
<main>
<div id="json-tree" class="json-tree" role="tree" aria-label="JSON
structure"></div>
</main>
</div>
const CONFIG = {
expandIcon: '+',
collapseIcon: '-'
};
/**
* Creates a DOM element with given properties
*/
function createElement(tag, props = {}, attributes = {}) {
const element = document.createElement(tag);
Object.assign(element, props);
// Add data attributes and other HTML attributes
Object.entries(attributes).forEach(([key, value]) => {
element.setAttribute(key, value);
});
return element;
}
/**
* Gets the precise type of a value
*/
function getValueType(value) {
if (value === null) return 'null';
if (Array.isArray(value)) return 'array';
if (value instanceof Date) return 'date';
return typeof value;
}
Documentation: NoSQL JSON Manager 35
/**
* Formats a value for display based on its type
*/
function formatValue(value, type) {
switch (type) {
case 'string':
return `"${value}"`;
case 'null':
return 'null';
case 'undefined':
return 'undefined';
case 'date':
return `"${value.toISOString()}"`;
default:
return String(value);
}
}
/**
* Creates the value display element with appropriate type information
*/
function createValueDisplay(value) {
const type = getValueType(value);
const isExpandable = type === 'object' || type === 'array';
if (isExpandable) {
return createElement('span', {
className: 'json-value',
textContent: type === 'array' ? ': [' : ': {'
}, {
'data-type': type
});
}
return createElement('span', {
className: 'json-value',
textContent: `: ${formatValue(value, type)}`
}, {
'data-type': type
});
}
/**
* Renders a JSON tree structure
*/
function renderJsonTree(json, container, indent = 0) {
Object.entries(json).forEach(([key, value]) => {
const type = getValueType(value);
const isExpandable = type === 'object' || type === 'array';
if (isExpandable) {
const childContainer = createElement('div', {
className: 'json-children'
}, {
'style': 'display: none',
'role': 'group'
});
toggleButton.addEventListener('click', () => {
const isCollapsed = childContainer.style.display === 'none';
childContainer.style.display = isCollapsed ? 'block' : 'none';
toggleButton.textContent = isCollapsed ? CONFIG.collapseIcon :
CONFIG.expandIcon;
toggleButton.setAttribute('aria-expanded', isCollapsed);
});
} else {
node.append(keySpan, valueSpan);
}
container.appendChild(node);
});
}
</body>
</html>
/* If user wants Light mode they use this by uncommenting the code
--primary-color: #100d0d;
--background-page: #e0e1e6;
--background-content: #edeef0; */
/* Text colors */
--text-primary: #E8EAED; /* Light grey for primary text */
--text-secondary: #9AA0A6; /* Medium grey for secondary text */
/* Structural colors */
--border-color: #3C4043; /* Dark grey for borders */
/* Syntax highlighting */
--string-color: #81C995; /* Light green for strings */
--number-color: #8AB4F8; /* Light blue for numbers */
--boolean-color: #C58AF9; /* Light purple for booleans */
}
body {
display: flex;
min-height: 100vh;
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Arial, sans-serif;
font-weight: bolder;
background-color: var(--background-page);
color: var(--text-primary);
line-height: 1.5;
font-size: 20px;
}
.container {
flex: 1;
max-width: 1200px;
margin: 24px auto;
padding: 40px;
background-color: var(--background-content);
border-radius: 8px;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3),
0 4px 8px 3px rgba(0, 0, 0, 0.15);
}
h1 {
margin: 0 0 32px 0;
font-size: 32px;
font-weight: 500;
color: var(--primary-color);
letter-spacing: 0.25px;
.json-tree {
font-family: 'Roboto Mono', 'Monaco', 'Consolas', monospace;
font-size: 20px;
font-weight: bolder;
line-height: 1.8;
letter-spacing: 0.3px;
}
.json-node {
position: relative;
margin: 4px 0;
padding: 4px 0 4px 28px; /* Added vertical padding */
border-left: 2px solid var(--border-color);
transition: all 0.2s ease;
}
.json-node:hover {
border-left-color: var(--hover-color);
background-color: var(--hover-bg);
}
.json-key {
color: var(--primary-color);
font-weight: bolder;
font-size: 20px;
}
.json-value {
color: var(--text-secondary);
font-size: 20px;
}
.json-toggle {
position: absolute;
left: -14px;
width: 24px;
height: 24px;
padding: 0;
background: var(--background-content);
border: 1px solid var(--border-color);
border-radius: 4px;
color: var(--text-secondary);
font-size: 14px;
cursor: pointer;
transition: all 0.15s ease;
display: flex;
align-items: center;
justify-content: center;
}
.json-toggle:hover {
background: var(--hover-color);
border-color: var(--primary-color);
color: var(--text-primary);
}
.json-toggle:focus {
outline: none;
.json-children {
margin-left: 6px;
padding-left: 20px;
}
/* Value Types */
.json-value[data-type="string"] {
color: var(--string-color);
}
.json-value[data-type="number"] {
color: var(--number-color);
}
.json-value[data-type="boolean"] {
color: var(--boolean-color);
}
/* Custom Scrollbar */
::-webkit-scrollbar {
width: 12px;
}
::-webkit-scrollbar-track {
background: var(--background-page);
border-radius: 6px;
}
::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
background: #5F6368;
}
/* Selection style */
::selection {
background-color: rgba(229, 146, 3, 0.3);
color: var(--text-primary);
}
/* Responsive Design */
@media (max-width: 768px) {
.container {
margin: 12px;
padding: 20px;
}
.json-tree {
font-size: 13px;
}
}
5. Operation (Append, Set Only, Get All, Get Only, Remove, Reset)
- append.py
import requests
url = 'http://127.0.0.1:5000/api/data/append/nosql@db/users'
payload = {
"value": {
"User2": {"name": "Peter Doe", "age": 12}
}
}
- setonly.py
import requests
url = 'http://127.0.0.1:5000/api/data/set/nosql@db/users/User1/name'
payload = {"value": "Ramesh"}
- getall.py
import requests
response = requests.get('http://127.0.0.1:5000/api/data')
print(response.json())
response =
requests.get('http://127.0.0.1:5000/api/data/get/nosql@db/users/User1')
print(response.json()) # This will print the value at the path "some/key"
- rem.py
import requests
url = 'http://127.0.0.1:5000/api/data/remove/nosql@db/users/User1/name'
# Provide the correct path for the selected field or node
payload = {} # No need to send a value, just the endpoint for removal
- reset.py
import requests
response = requests.post('http://127.0.0.1:5000/api/data/reset')
print(response.json())
# Expected output: {"message": "Database reset!"}