Creating and Parsing JSON Data with ESP32 IDF

Creating and Parsing JSON Data with ESP32 IDF

Introduction:When developing with the ESP32, my favorite framework to use is the IDF framework, which is flexible, convenient, and comprehensive. This article utilizes the espressif__json_generator and espressif__json_parser components under the IDF framework to implement the creation and parsing of JSON data format. 1. espressif__jsmn is a dependency and will be automatically downloaded II. Writing the … Read more

The Ultimate Guide to Formatting HTTP Request Bodies in Frontend: Understanding JSON, FormData, and x-www-form-urlencoded

The Ultimate Guide to Formatting HTTP Request Bodies in Frontend: Understanding JSON, FormData, and x-www-form-urlencoded

In actual frontend development, when interacting with backend APIs, have you ever been confused between <span>application/json</span>、<span>application/x-www-form-urlencoded</span> and <span>multipart/form-data</span>? This article will provide detailed code examples (using Fetch API and Axios) to thoroughly explain the differences, applicable scenarios, and practical applications of these three common Content-Types, allowing you to navigate the path of request body formatting … Read more

A Brief Usage of CSV in Python

A Brief Usage of CSV in Python

CSV is a flexible data format that can be easily opened and edited with both text editors and spreadsheet software. Below, I will write a simple example, with the code as follows: # Example code to create CSV files After running the code, there are three CSV files in the current directory: data_list.csv, data_list0.csv, and … Read more

IoT Series – Remote Control of RGB Lights Based on MQTT (Part 1: Theoretical Background)

IoT Series - Remote Control of RGB Lights Based on MQTT (Part 1: Theoretical Background)

1. Motivation Recently, while teaching an Android development course to third-year students at a vocational college, I noticed that the students primarily focused on embedded development and may not be very familiar with software development. As they are about to start their graduation projects, this series of articles aims to guide them in building a … Read more

Comprehensive Python Project: Student Grade Management System (Command Line Version)

After learning the basic syntax, functions, file operations, and data structures of Python, the most important step is to “combine the scattered skills into practice”. A command line version of a student grade management system is very suitable as a small project at this stage, as it does not require any GUI framework but covers … Read more

2. Handling HTTP Requests with Gin – Generating HTTP Responses

2.5 Generating HTTP Responses 2.5.1 Setting the Response Body In the Gin framework, you can use methods in <span>gin.Context</span> such as <span>String()</span>, <span>JSON()</span>, <span>XML()</span>, <span>HTML()</span>, and <span>File()</span> to generate HTTP responses. The <span>gin.Context</span> object is passed as a parameter to the route handler function, providing methods to set the <span>response status code</span>, <span>headers</span>, and <span>response … Read more

A Practical Guide to JSON Processing in Linux Using the jq Command Line Tool

<span>JSON</span> processing is a common operation in operations and maintenance,<span>API</span> returns, configuration files, log analysis, etc. all involve it. Especially in <span>K8S/Docker</span> operation and maintenance scenarios,<span>JSON</span> data processing is a routine task. This article introduces a <span>Linux JSON</span> data processing tool – <span>jq</span>, which is much more powerful than <span>grep</span> and <span>awk</span>. This is what … Read more

Mastering Data Exchange with Python’s JSON Four Musketeers!

Have you ever struggled with JSON data processing? The four core functions of Python make it easy to handle data exchange! In daily development, JSON is everywhere: API interfaces, configuration files, data storage… As a Python developer, mastering the four core functions of the json module is an essential skill. Today, we will delve into … Read more

Rust Pattern Matching: Taming the “Schrödinger’s Cat” of JSON

Rust Pattern Matching: Taming the “Schrödinger’s Cat” of JSON The Pain of API JSON Schemas: The Love-Hate Relationship with JSON After exploring the HTTP Request API HMAC signature: adding a “security label” to API requests, we finally saw the long-awaited HTTP response. As a heavy user of APIs, I deal with various JSON data every … Read more

Advanced Python Programming Techniques

16. Decorators Decorators are Python’s “syntactic sugar” used to add additional functionality to functions without modifying the original function’s code (such as logging, timing, permission validation, etc.). 1. Basic Decorators # Define a decorator (essentially a function that takes another function as an argument) def log_decorator(func): def wrapper(*args, **kwargs): print(f"Starting execution of function: {func.__name__}") # … Read more