Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Optimization method and system for JSON serialization and deserialization

A technology of deserialization and optimization methods, which is applied in the direction of program code conversion, instrumentation, and electrical digital data processing, etc. It can solve problems such as unfavorable multi-person collaboration, error concealment, and difficulty in error correction, so as to facilitate multi-person collaboration and fast writing Effect

Pending Publication Date: 2021-07-20
SHANGHAI INNOMOTION
View PDF0 Cites 3 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0007] 1. It is inconvenient to use, which greatly affects programming efficiency: programmers cannot intuitively see in the code editor which accessible attribute objects exist in the JSON data that needs to be converted by the current business logic, and the value types of these attributes;
[0008] 2. It is not conducive to multi-person collaboration: JSON is used for serialization and deserialization in the programming process for data exchange. The JSON data format may be defined by a software designer, and software programmers who use JSON for data exchange may Not the former, which makes programmers have to fully understand or easily query the structure and content of JSON data formatters, which may lead to a lot of communication or write documentation for query to solve this problem, greatly reducing the Improve the reliability and efficiency of multi-person cooperation
[0009] 3. Error-prone, hidden errors, and difficult error correction: once programmers make mistakes or omit the corresponding attributes in JSON data, the code editor cannot give error prompts during the grammar detection stage
There may not be an error when the program is running, but it will cause the data stored in the serialized JSON string to be wrong, and it will also cause the deserialization to fail to parse the correct attribute value, resulting in data with this JSON A series of exchanged business logic uses wrong data until a data-sensitive business logic makes an error, which leads to error concealment, it is difficult to trace the source of the error, and even causes serious adverse consequences to the entire system

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Optimization method and system for JSON serialization and deserialization
  • Optimization method and system for JSON serialization and deserialization
  • Optimization method and system for JSON serialization and deserialization

Examples

Experimental program
Comparison scheme
Effect test

no. 1 example

[0047] Such as figure 1 As shown, this embodiment provides an optimization method for JSON serialization and deserialization, including:

[0048] Create an abstract base class of JSON objects for optimizing JSON serialization and deserialization, define in the abstract base class of JSON objects including creating various types of attributes, and implement macro definition objects for parsing functions for each attribute.

[0049] Specifically, create a JSON object abstract base class, and then according to the JSON object abstract base class, for a specific single JSON object, the JSON object in the key-value format inherits the JSON object abstract base class, redefines the generated object A business logic class for a single JSON object. When programmers access and call JSON objects, they don’t need to understand the specific attributes in JSON objects. The code editor can directly display all attributes through syntax prompts, which is convenient for multiple people to co...

no. 2 example

[0076] This embodiment provides a specific example of using a macro to define a subclass corresponding to JSON.

[0077] For example, there is a JSON object of student (Student) data, which includes: number (string ID), name (string Name), gender (bool Sex), age (int Age). Its json data is as follows:

[0078]

[0079] It corresponds to define a Student class, where WJsonObject is the abstract base class of the Json object provided by the present invention, as follows:

[0080]

[0081]

no. 3 example

[0083] This embodiment provides a system for performing the optimization method of JSON serialization and deserialization as in the first embodiment, including:

[0084] The abstract base class creation module is used to create the JSON object abstract base class optimized for JSON serialization and deserialization, and the definition in the JSON object abstract base class includes creating various types of attributes and implementing parsing functions for each attribute The macro definition object;

[0085] The deserialization module is used to parse JSON data through JSON parsing libraries including QJSON, JsonCpp, RapidJSON, and Parson when performing deserialization operations on JSON, and generate JSON object key-value pairs in key-value format. Then create a business logic class containing all attribute members of the JSON data by calling the JSON object abstract base class, and assign a value to each attribute;

[0086] The serialization module is used to call the busi...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention relates to the technical field of JSON serialization and deserialization optimization, and provides an optimization method and system for JSON serialization and deserialization, and the method comprises the steps: creating a JSON object abstraction base class for optimizing JSON serialization and deserialization, and defining macro definition objects for the creation of various types of attributes and the realization of the analysis of each attributein the JSON object abstract base class ; when a deserialization operation is executed on the JSON, analyzing the JSON data through the JSON analysis library, generating a JSON object key value pair in a key-va ue format, then creating a service logic class of all attribute members containing the JSON data by calling a JSON object abstract base class, and performing assignment on each attribute; and when serialization operation is executed on the JSON, calling a service logic class, obtaining a specific value of an attribute member, forming a JSON object key value pair in a key-va ue format, and further executing serialization operation on the JSON object key value pair through the JSON analysis library to generate serialized JSON data.

Description

technical field [0001] The invention relates to the technical field of JSON serialization and deserialization optimization, in particular to an optimization method and system for JSON serialization and deserialization. Background technique [0002] JSON is a lightweight data interchange format. Easy for humans to read and write, but also easy for machines to parse and generate. It is widely used in software development and programming. [0003] Serialization is a method of storing class objects in a high-level language (such as C++) in the form of bytes on disk or transmitting data during software programming. Deserialization is the method of restoring the serialized byte object to a class object. In programming practice, JSON is used as the data storage format, and the method of serialization and deserialization is widely used. [0004] When using JSON for serialization operations, it is necessary to generate corresponding JSON strings for each attribute of the class ob...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F8/30G06F8/41
CPCG06F8/315G06F8/42
Inventor 王少白周武建侯尧
Owner SHANGHAI INNOMOTION
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products