Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
JSON Articles
Found 152 articles
How to return a JSON object from a Python function in Tkinter?
JSON (JavaScript Object Notation) is a lightweight data format for exchanging data between different programming languages. In Python, you can work with JSON using the built-in json module, which provides methods to convert Python objects to JSON strings and vice versa. When working with Python functions, you often need to return structured data as JSON objects. This is particularly useful in web applications, APIs, and data processing tasks where standardized data exchange is important. Understanding JSON Conversion Python converts objects to JSON through serialization − the process of transforming Python data structures into a JSON-compatible string format. ...
Read MoreHow I can create Python class from JSON object?
Creating Python classes from JSON objects can be accomplished using the python-jsonschema-objects library, which is built on top of jsonschema. This library provides automatic class-based binding to JSON schemas for use in Python. Installing the Required Library First, install the python-jsonschema-objects library ? pip install python-jsonschema-objects Defining a JSON Schema Let's start with a sample JSON schema that defines the structure of a Person object ? schema = '''{ "title": "Example Schema", "type": "object", "properties": { ...
Read MoreHow to convert Python date in JSON format?
There is no standard JSON format for dates. However, the ISO 8601 format is widely accepted as it's human readable, sorts correctly, includes fractional seconds, and is compatible with most programming languages. Python provides several methods to convert dates to JSON-compatible ISO format. Using isoformat() Method The isoformat() method is the simplest way to convert a Python datetime object to ISO 8601 format ? from datetime import datetime my_date = datetime.now() print(my_date.isoformat()) 2018-01-02T22:08:12.510696 Using strftime() Method For more control over the output format, you can use the strftime() function ...
Read MoreWhat are the differences between json and simplejson Python modules?
Both json and simplejson are Python modules for working with JSON data, but they have key differences in availability, performance, and update frequency. What is json? The json module is part of Python's standard library since Python 2.6. It provides basic JSON encoding and decoding functionality ? import json data = {"name": "Alice", "age": 30, "city": "New York"} json_string = json.dumps(data) print(json_string) # Parse JSON back to Python object parsed_data = json.loads(json_string) print(parsed_data) {"name": "Alice", "age": 30, "city": "New York"} {'name': 'Alice', 'age': 30, 'city': 'New York'} What is ...
Read MoreHow to Convert String to JSON using Python?
In this article, we are going to learn how to convert a string to JSON in Python. JSON is a lightweight data interchange format that is used to read and write, and store data. Usually, we receive JSON data in the form of a string. To process it using a Python program, we need to convert the JSON string into an object, which can be stored in Python dictionaries and lists. This conversion can be done by using functions provided by the Python JSON module. Using Python json.loads() Function The Python json.loads() function is used to convert ...
Read MoreHow to Install Bower on Ubuntu
Bower is a package manager for web development that provides a standardized approach to front-end package management. It maintains and monitors all packages, checks for updates, and uses a manifest file called bower.json to track dependencies. This article explains how to install Bower on Ubuntu. Prerequisites To install Bower, you need Node.js and NPM pre-installed on your system. First, verify that Node.js is installed by checking its version: $ node -v The output should display the Node.js version: v6.9.2 Next, verify the NPM version: $ npm -v ...
Read MoreGuide to Linux jq Command for JSON Processing
JSON (JavaScript Object Notation) is a popular data format used for exchanging information between applications. It is lightweight and easy to understand. To process JSON data efficiently, Linux provides a command-line tool called jq. This powerful tool enables users to extract, manipulate, and transform JSON data with ease. With jq, users can quickly perform filtering, sorting, and selecting specific fields. Additionally, jq supports various output formats, making it easy to integrate with other command-line tools. Installation Before using jq, ensure it is installed on your system. jq can be installed using the Linux package manager. Ubuntu/Debian Installation ...
Read MoreHow to Fetch Data from JSON file and Display it in an HTML Table using jQuery?
JSON (JavaScript Object Notation) is a lightweight data interchange format that has become the standard for transmitting data between servers and web applications. With jQuery, you can easily fetch data from a JSON file and dynamically display it in an HTML table, creating interactive and data-driven web pages. Syntax The primary jQuery method for fetching JSON data is − $.getJSON(url, data, success) Parameters − url − The URL of the JSON file or API endpoint from which to retrieve data. Can be relative or absolute. data (optional) − Additional data to send ...
Read MoreHow to Convert JSON to Excel in JavaScript?
Converting JSON data to Excel format is a common requirement in web applications, especially for data export and reporting functionality. Excel files are widely used for data presentation and analysis, making JSON-to-Excel conversion essential for seamless data management. This article explores different methods to convert JSON data to Excel files using JavaScript, including library-based approaches and manual techniques. Approaches to Convert JSON to Excel in JavaScript Using the SheetJS (xlsx) library Manual HTML Table Export Exporting JSON to CSV format Using the SheetJS ...
Read MoreUsing data in JSON format in Snack
There are many ways to use data with apps made with Snack Expo. Sometimes the data is stored as JSON (JavaScript Object Notation). In this format, data can be easily stored as key-value pairs and can also be converted to CSV files. This article demonstrates how to use JSON data in Snack using JavaScript, including reading JSON data and displaying it as a table, plus converting JSON to CSV format for download. Sample JSON Data Structure For our examples, we'll use a products.json file containing product information: { "products": [ ...
Read More