Method and system for comparing JSON deltas when upgrading a web application

By parsing and comparing JSON strings to generate differential results, the problem of retaining personalized configurations during the upgrade of low-code platform web applications is solved, and efficient version upgrades are achieved.

CN116501360BActive Publication Date: 2026-07-14航信云享科技有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
航信云享科技有限公司
Filing Date
2022-12-24
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

In the process of upgrading web applications built on low-code platforms, it is difficult to achieve differentiated upgrades between high and low versions by existing technologies, as it is necessary to complete the version upgrade while retaining personalized configurations.

Method used

By obtaining JSON strings of the high version, the original low version, and the low version containing personal configuration, parsing them into JSONObjects, using key-value pairs for description and comparison, generating differential results, and using FASTJSON, GSON, or NET.SF.JSON packages for parsing, defining differential type identifiers, and generating accurate upgrade differential results.

Benefits of technology

It enables precise upgrades of older JSON strings containing personal configurations, providing clear, concise, and comprehensive differential results, and supports efficient version upgrades.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116501360B_ABST
    Figure CN116501360B_ABST
Patent Text Reader

Abstract

The application provides a method and system for comparing JSON differences during web application upgrade, comprising obtaining JSON strings of a web application to be upgraded, the JSON strings comprising high version, original low version and low version containing personal configuration of the web application to be upgraded, parsing and converting the JSON strings into JSONObject, and using key-value pairs to describe elements in the JSONObject, and comparing the key-value pairs of the elements in the JSONObject of the three versions to obtain a difference result, so as to realize accurate upgrade of the low version JSON string containing personal configuration, wherein the difference result comprises a pre-defined identifier representing a difference type. The method and system make the comparison result of the JSON strings of different versions of the web application particularly clear and concise, and easy to understand, and because of the comparison of each item, the description information of the difference result is complete, and can be used for accurate upgrade of the JSON structure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data analysis technology, and more specifically, to a method and system for comparing JSON differences during web application upgrades. Background Technology

[0002] Low-code platforms typically use JSON structured data to represent pages, with different functionalities forming a complete system application. These applications are constantly updated and iterated as requirements change and increase, necessitating version upgrades. The simplest and most direct upgrade solution is to directly replace the lower version with the higher one. However, in actual development, developers and implementers often customize page configurations, wanting to retain their changes while also adapting the higher version to the lower one. This necessitates a more targeted upgrade approach, addressing the specific differences between the higher and lower versions, rather than a simple replacement. Summary of the Invention

[0003] To address the issue that existing systems using JSON-structured data need to both upgrade their versions and retain some custom configurations during upgrades, this invention provides a method and system for comparing JSON differences during application upgrades.

[0004] According to one aspect of the present invention, a method for comparing JSON differences during web application upgrades is provided, the method comprising:

[0005] Obtain the JSON string of the web application to be upgraded, wherein the JSON string is data describing the layout and controls on the page template of the web application to be upgraded, and the JSON string includes the high version JSON string of the web application to be upgraded, the original low version JSON string, and the low version JSON string containing personal configuration.

[0006] The high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration are respectively parsed and transformed into a first JSONObject, a second JSONObject, and a third JSONObject;

[0007] The elements in the first JSONObject, the second JSONObject, and the third JSONObject are all described using key-value pairs, where each element refers to a comma-separated part of the first JSONObject, the second JSONObject, and the key-value pair refers to the name and value of the element;

[0008] The key-value pairs in the first JSONObject and the second JSONObject are compared to generate a first difference result; and

[0009] The key-value pairs in the second JSONObject and the third JSONObject are compared to generate a second difference result;

[0010] The first difference result and the second difference result are compared to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded;

[0011] The first, second, and third difference results include predefined identifiers describing the difference type.

[0012] Optionally, the high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration can be parsed and transformed into a first JSONObject, a second JSONObject, and a third JSONObject, respectively, using any one of the FASTJSON package, the GSON package, and the NET.SF.JSON package.

[0013] Optionally, the elements in the first JSONObject, the second JSONObject, and the third JSONObject are all described using key-value pairs, including:

[0014] When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects, the element is parsed into a first-level child node. The internal elements of the first-level child node are then parsed until a simple value is read. Finally, the key name of the key-value pair is the name of each level child node concatenated with dots, and the key value is a simple value, which includes string, number, boolean, and null.

[0015] When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONArrays, if the elements in the JSONArray are simple values, the key name of the final key-value pair is the JSONArray name concatenated in [], and the key value is a simple value; if the elements in the JSONArray are JSONObjects, each element in the JSONArray is first determined by concatenating the JSONArray name with [key-value pairs with unique names in the JSONArray], and then parsed and generated as a final key-value pair according to the method used when the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects.

[0016] Optionally, before obtaining the JSON string of the web application to be upgraded, the method further includes defining an identifier representing the difference type, the identifier including:

[0017] The first identifier is used to indicate that when the two final key-value pairs being compared have the same key name and the key values ​​corresponding to the key names are both simple values, the key values ​​of the two key-value pairs have changed.

[0018] The second identifier is used to indicate that the two final key-value pairs being compared are such that the element name of the JSONObject appended to the key name of one final key-value pair does not exist in the key name of the other final key-value pair.

[0019] The third identifier is used to represent the two final key-value pairs being compared. The key name of a final key-value pair is the JSONArray name concatenated with the part "[key-value pairs with unique names in the JSONArray]". The key-value pairs with unique names in the JSONArray have the same key name but different key values.

[0020] Optionally, the key-value pairs in the first JSONObject and the second JSONObject are compared to generate a first difference result, including:

[0021] Each final key-value pair in the first JSONObject is compared with all final key-value pairs in the second JSONObject in the order of key name first, then key value. Similarly, each final key-value pair in the second JSONObject is compared with all final key-value pairs in the first JSONObject in the order of key name first, then key value.

[0022] When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is the first identifier, a difference record is generated, denoted as key name: (first identifier)origin the key value of the final key-value pair in the second JSONObject actual the key value of the final key-value pair in the first JSONObject;

[0023] When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is a second identifier, a difference record is generated, denoted as: (second identifier)origin NotFound actual The key value of the final key-value pair in the first JSONObject, or: (second identifier)origin The key value of the final key-value pair in the second JSONObject actual NotFound, wherein the duplicate key name refers to the common part of the key name of the final key-value pair in the first JSONObject and the final key-value pair in the second JSONObject;

[0024] When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is a third identifier, a difference record is generated, denoted as the duplicate key name: (third identifier)|uKey: key name of the key-value pair with a unique name in the JSONArray|origin[key value of the key-value pair with a unique name in the JSONArray of the second JSONObject]actual[key value of the key-value pair with a unique name in the JSONArray of the first JSONObject];

[0025] The set of all difference records is denoted as the first difference result.

[0026] The key-value pairs in the second JSONObject and the third JSONObject are compared to generate a second difference result, including:

[0027] Each final key-value pair in the second JSONObject is compared with all final key-value pairs in the third JSONObject in the order of key name first, then key value; and each final key-value pair in the third JSONObject is compared with all final key-value pairs in the second JSONObject in the order of key name first, then key value.

[0028] When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is the first identifier, a difference record is generated, denoted as key name: (first identifier)origin the key value of the final key-value pair in the second JSONObject actual the key value of the final key-value pair in the third JSONObject;

[0029] When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is the second identifier, a difference record is generated, denoted as the duplicate key name: (second identifier)originNotFound actualThe key value of the final key-value pair in the third JSONObject, or (second identifier)originThe key value of the final key-value pair in the second JSONObjectactualNotFound, where the duplicate key name refers to the common part of the key name of the final key-value pair in the second JSONObject and the final key-value pair in the third JSONObject;

[0030] When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is a third identifier, a difference record is generated, denoted as the duplicate key name: (third identifier)|uKey: key name of the key-value pair with a unique name in the JSONArray|origin[key value of the key-value pair with a unique name in the JSONArray of the second JSONObject]actual[key value of the key-value pair with a unique name in the JSONArray of the third JSONObject];

[0031] The set of all difference records is denoted as the second difference result.

[0032] Optionally, the first difference result and the second difference result are compared to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded, including:

[0033] Remove all difference records in the first difference result that are identical to those in the second difference result;

[0034] Remove all difference records in the first difference result that have the same key name but different key values, using the identifier of the difference type as the first identifier and the key name as the first identifier.

[0035] The remaining difference record of the first difference result is recorded as the third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded.

[0036] According to another aspect of the present invention, the present invention provides a system for comparing JSON differences during web application upgrades, the system comprising:

[0037] The character acquisition unit is used to acquire the JSON string of the web application to be upgraded. The JSON string is data describing the layout and controls on the page template of the web application to be upgraded. The JSON string includes a high-version JSON string of the web application to be upgraded, an original low-version JSON string, and a low-version JSON string containing personal configuration.

[0038] The character parsing unit is used to parse the high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration into a first JSONObject, a second JSONObject, and a third JSONObject, respectively.

[0039] The text conversion unit is used to describe the elements in the first JSONObject, the second JSONObject, and the third JSONObject using key-value pairs, wherein the element refers to each comma-separated part of the first JSONObject, the second JSONObject, and the third JSONObject, and the key-value pair refers to the name and value of the element;

[0040] The first comparison unit is used to compare the key-value pairs in the first JSONObject and the second JSONObject to generate a first difference result; and

[0041] The second comparison unit is used to compare the key-value pairs in the second JSONObject and the third JSONObject to generate a second difference result;

[0042] The third comparison unit is used to compare the first difference result and the second difference result to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded.

[0043] The first, second, and third difference results include predefined identifiers describing the difference type.

[0044] Optionally, the character parsing unit uses any one of the FASTJSON package, GSON package, and NET.SF.JSON package to parse the high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration into a first JSONObject, a second JSONObject, and a third JSONObject, respectively.

[0045] Optionally, the text conversion unit describes the elements in the first JSONObject, the second JSONObject, and the third JSONObject using key-value pairs, including:

[0046] When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects, the element is parsed into a first-level child node. The internal elements of the first-level child node are then parsed until a simple value is read. Finally, the key name of the key-value pair is the name of each level child node concatenated with dots, and the key value is a simple value, which includes string, number, boolean, and null.

[0047] When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONArrays, if the elements in the JSONArray are simple values, the key name of the final key-value pair is the JSONArray name concatenated in [], and the key value is a simple value; if the elements in the JSONArray are JSONObjects, each element in the JSONArray is first determined by concatenating the JSONArray name with [key-value pairs with unique names in the JSONArray], and then parsed and generated as a final key-value pair according to the method used when the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects.

[0048] This invention provides a method and system for comparing JSON differences during web application upgrades. The method includes obtaining a JSON string of the web application to be upgraded. This JSON string includes a high version of the web application, an original low version, and a low version containing personal configurations. The JSON string is parsed and converted into a JSONObject, and elements within the JSONObject are described using key-value pairs. The difference results obtained by comparing the key-value pairs of elements in the three versions of the JSONObject enable precise upgrades to the low version JSON string containing personal configurations. The difference results include predefined identifiers representing the difference type. The method and system use key-value pairs to describe the JSONObjects converted from the high version, original low version, and low version containing personal configurations, and compare these key-value pairs to obtain difference results. Different identifiers represent the difference types in the difference results, and unique key-value pairs distinguish multiple JSONObjects within a JSONArray. This makes the comparison results particularly clear, concise, and easy to understand. Furthermore, because the comparison is performed line by line, the descriptive information of the difference results is complete, making it suitable for precise upgrades of JSON structures.

[0049] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0050] The above and other objects, features, and advantages of the present invention will become more apparent from the more detailed description of the embodiments of the invention in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same parts or steps.

[0051] Figure 1 A flowchart illustrating a method for comparing JSON differences during web application upgrades according to a preferred embodiment of the present invention;

[0052] Figure 2 This is a schematic diagram of the structure of a system for comparing JSON differences during web application upgrades according to a preferred embodiment of the present invention. Detailed Implementation

[0053] Hereinafter, exemplary embodiments according to the present invention will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present invention, and not all embodiments of the present invention. It should be understood that the present invention is not limited to the exemplary embodiments described herein.

[0054] It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps described in these embodiments do not limit the scope of the invention.

[0055] Those skilled in the art will understand that the terms "first," "second," etc., in the embodiments of the present invention are only used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor do they indicate a necessary logical order between them.

[0056] It should also be understood that in the embodiments of the present invention, "multiple" can refer to two or more, and "at least one" can refer to one, two or more.

[0057] It should also be understood that any component, data or structure mentioned in the embodiments of the present invention can generally be understood as one or more unless explicitly defined or given contrary instructions in the context.

[0058] Furthermore, the term "and / or" in this invention is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this invention generally indicates that the preceding and following related objects have an "or" relationship.

[0059] It should also be understood that the description of the various embodiments in this invention emphasizes the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, they will not be described in detail.

[0060] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.

[0061] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the invention or its application or use.

[0062] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, they should be considered part of the specification.

[0063] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.

[0064] The embodiments of this invention can be applied to electronic devices such as terminal devices, computer systems, and servers, and can operate together with a wide range of other general-purpose or special-purpose computing system environments or configurations. Well-known examples of terminal devices, computing systems, environments, and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, and servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments including any of the above systems, etc.

[0065] Electronic devices such as terminal devices, computer systems, and servers can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in distributed cloud computing environments, where tasks are executed by remote processing devices linked through communication networks. In distributed cloud computing environments, program modules can reside on local or remote computing system storage media, including storage devices.

[0066] Exemplary methods

[0067] Figure 1 This is a flowchart illustrating a method for comparing JSON differences during web application upgrades according to a preferred embodiment of the present invention. Figure 1 As shown, the method for comparing JSON differences during web application upgrades according to this preferred embodiment begins from step 101.

[0068] In step 101, obtain the JSON string of the web application to be upgraded, wherein the JSON string is data describing the layout and controls on the page template of the web application to be upgraded, and the JSON string includes the high version JSON string of the web application to be upgraded, the original low version JSON string, and the low version JSON string containing personal configuration.

[0069] In one embodiment, the interface of a web application is entirely described by a set of JSON strings, with different functional pages forming the complete application. As requirements change and increase, these applications are continuously updated and iterated, leading to application version upgrades. The simplest and most direct upgrade solution is to directly replace the lower version with the higher version. However, in actual development, developers and implementers often customize the pages, wanting to retain their modifications while also upgrading the differences between the higher and lower versions. This necessitates a more complex upgrade process than simply replacing the existing version. Therefore, to accurately describe the differences between the higher and lower versions, and between the original lower version and the lower version containing personal configurations, thus achieving precise upgrades, it is essential to compare the JSON differences between the different versions. To perform this comparison, it is necessary to first obtain the higher version JSON string, the original lower version JSON string, and the lower version JSON string containing personal configurations from the web application to be upgraded.

[0070] In step 102, the high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration are respectively parsed and converted into a first JSONObject, a second JSONObject, and a third JSONObject.

[0071] Preferably, any one of the FASTJSON package, GSON package, and NET.SF.JSON package is used to parse and convert the high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration into a first JSONObject, a second JSONObject, and a third JSONObject, respectively.

[0072] In one embodiment, there are various existing tools for converting JSON strings into JSONObjects, such as Alibaba's FASTJSON package, Google's GSON package, and other NET.SF.JSON packages. Any of these can be used to achieve the above parsing and conversion.

[0073] In step 103, the elements in the first JSONObject, the second JSONObject, and the third JSONObject are described using key-value pairs. Here, the element refers to each comma-separated part of the first JSONObject, the second JSONObject, and the third JSONObject, and the key-value pair refers to the name and value of the element.

[0074] Preferably, the elements in the first JSONObject, the second JSONObject, and the third JSONObject are all described using key-value pairs, including:

[0075] When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects, the element is parsed into a first-level child node. The internal elements of the first-level child node are then parsed until a simple value is read. Finally, the key name of the key-value pair is the name of each level child node concatenated with dots, and the key value is a simple value, which includes string, number, boolean, and null.

[0076] When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONArrays, if the elements in the JSONArray are simple values, the key name of the final key-value pair is the JSONArray name concatenated in [], and the key value is a simple value; if the elements in the JSONArray are JSONObjects, each element in the JSONArray is first determined by concatenating the JSONArray name with [key-value pairs with unique names in the JSONArray], and then parsed and generated as a final key-value pair according to the method used when the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects.

[0077] In one embodiment, after converting the JSON string into a large JSONObject, some element attributes are relatively simple, and the element name can be used as the key and the simple value as the value. For example, the navigation template navPageTemp is set in the current template. The original low version was set to template 350373594923172621, and the high version is changed to template 958991379809073281. Then the corresponding key-value pair in the original low version is navPageTemp: 350373594923172621, and the key-value pair in the high version is navPageTemp: 958991379809073281.

[0078] Because JSONObject and JSONArray can be nested, a single element in a JSONObject may have multiple levels of properties. When describing these multiple levels of properties using key-value pairs, the property names in the keys need to be concatenated. An example of an earlier version of JSONObject is as follows:

[0079]

[0080]

[0081] In the JSONObject above, the element with the key name "fields" has a key value of JSONArray. This JSONArray contains two JSONObjects. To distinguish between these two JSONObjects, a unique key is needed. A unique key refers to any key-value pair that guarantees the uniqueness of the JSONObjects within the JSONArray. In the example above, the key-value pairs __vModel__:custom_field_1650778368053 and __vModel__: can be chosen.

[0082] The key-value pair can be distinguished by `custom_field_1625494212138`. Once the JSONObjects within the JSONArray are determined, the key-value pairs can be determined according to the rules for elements within a JSONObject. Specifically, for the simple value `cell-click` in the example, its final key-value pair can be represented as `fields[__vModel__:custom_field_1650778368053].On:cell-click`.

[0083] In step 104, the key-value pairs in the first JSONObject and the second JSONObject are compared to generate the first difference result.

[0084] In step 105, the key-value pairs in the second JSONObject and the third JSONObject are compared to generate a second difference result.

[0085] In step 106, the first difference result and the second difference result are compared to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded.

[0086] The first, second, and third difference results include predefined identifiers describing the difference type.

[0087] Preferably, before obtaining the JSON string of the web application to be upgraded, the method further includes defining an identifier representing the difference type, the identifier including:

[0088] The first identifier is used to indicate that when the two final key-value pairs being compared have the same key name and the key values ​​corresponding to the key names are both simple values, the key values ​​of the two key-value pairs have changed.

[0089] The second identifier is used to indicate that the two final key-value pairs being compared are such that the element name of the JSONObject appended to the key name of one final key-value pair does not exist in the key name of the other final key-value pair.

[0090] The third identifier is used to represent the two final key-value pairs being compared. The key name of a final key-value pair is the JSONArray name concatenated with the part "[key-value pairs with unique names in the JSONArray]". The key-value pairs with unique names in the JSONArray have the same key name but different key values.

[0091] Preferably, comparing the key-value pairs in the first JSONObject and the second JSONObject to generate a first difference result includes:

[0092] Each final key-value pair in the first JSONObject is compared with all final key-value pairs in the second JSONObject in the order of key name first, then key value. Similarly, each final key-value pair in the second JSONObject is compared with all final key-value pairs in the first JSONObject in the order of key name first, then key value.

[0093] When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is the first identifier, a difference record is generated, denoted as key name: (first identifier)origin the key value of the final key-value pair in the second JSONObject actual the key value of the final key-value pair in the first JSONObject;

[0094] When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is a second identifier, a difference record is generated, denoted as a duplicate key name: (second identifier)originNotFound actual The key value of the final key-value pair in the first JSONObject, or (second identifier)origin The key value of the final key-value pair in the second JSONObject actual NotFound, wherein the duplicate key name refers to the common part of the key name of the final key-value pair in the first JSONObject and the final key-value pair in the second JSONObject;

[0095] When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is a third identifier, a difference record is generated, denoted as the duplicate key name: (third identifier)|uKey: key name of the key-value pair with a unique name in the JSONArray|origin[key value of the key-value pair with a unique name in the JSONArray of the second JSONObject]actual[key value of the key-value pair with a unique name in the JSONArray of the first JSONObject];

[0096] The set of all difference records is denoted as the first difference result.

[0097] The key-value pairs in the second JSONObject and the third JSONObject are compared to generate a second difference result, including:

[0098] Each final key-value pair in the second JSONObject is compared with all final key-value pairs in the third JSONObject in the order of key name first, then key value; and each final key-value pair in the third JSONObject is compared with all final key-value pairs in the second JSONObject in the order of key name first, then key value.

[0099] When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is the first identifier, a difference record is generated, denoted as key name: (first identifier)origin the key value of the final key-value pair in the second JSONObject actual the key value of the final key-value pair in the third JSONObject;

[0100] When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is the second identifier, a difference record is generated, denoted as: (second identifier)originNotFound actualThe key value of the final key-value pair in the third JSONObject, or: (second identifier)originThe key value of the final key-value pair in the second JSONObjectactualNotFound, where the duplicate key name refers to the common part of the key name of the final key-value pair in the second JSONObject and the final key-value pair in the third JSONObject;

[0101] When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is a third identifier, a difference record is generated, denoted as the duplicate key name: (third identifier)|uKey: key name of the key-value pair with a unique name in the JSONArray|origin[key value of the key-value pair with a unique name in the JSONArray of the second JSONObject]actual[key value of the key-value pair with a unique name in the JSONArray of the third JSONObject];

[0102] The set of all difference records is denoted as the second difference result.

[0103] Preferably, the first difference result and the second difference result are compared to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded, including:

[0104] Remove all difference records in the first difference result that are identical to those in the second difference result;

[0105] Remove all difference records in the first difference result that have the same key name but different key values, using the identifier of the difference type as the first identifier and the key name as the first identifier.

[0106] The remaining difference record of the first difference result is recorded as the third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded.

[0107] Taking the final key-value pair fields[__vModel__:custom_field_1650778368053].On:cell-click of the original low-version JSONObject as an example:

[0108] If the final key-value pair of a higher version of JSONObject is fields[__vModel__:custom_field_1650778368053].On:cell-dclick, meaning that the two final key-value pairs have the same key name but the key value has changed, then the identifier of the difference type is defined as UPD, and the difference record compared between the two is fields[__vModel__:custom_field_1650778368053].On:(UPD)origin cell-click actual Cell-dclick.

[0109] If a new property is added to the higher version of JSONObject, and its final key-value pair is fields[__vModel__:custom_field_1650778368053].off:cell-ddclick, then the element name 'off' of JSONObject appended to the key name of the final key-value pair of the higher version of JSONObject does not exist in the key name of the final key-value pair of the original lower version of JSONObject. The identifier of this difference type is defined as NF, and the difference record for comparing the two is fields[__vModel__:custom_field_1650778368053]: (NF)origin NOTFOUND actual off.

[0110] If the JSONArray of the higher version JSONObject and the lower version JSONObject each contains a unique JSONObject, for example, the JSONObject in the lower version is fields[__vModel__:custom_field_1650778368053] while the JSONObject in the higher version is fields[__vModel__:custom_field_1650778368054], then it is equivalent to the objects in the two versions being changed. In this case, the identifier of the difference type is defined as IOD, and the difference record for comparing the two is fields: (IOD)|uKey: __vModel__|origin[custom_field_1650778368053]actual[custom_field_1650778368054].

[0111] In one embodiment, the difference between the key-value pairs of the high-version JSONObject and the original low-version JSONObject is used as the first difference result, and the difference between the key-value pairs of the original low-version JSONObject and the low-version JSONObject containing personal configurations is used as the second difference result. Since the second difference result represents changes made to the web application by secondary developers and implementers, and is a personal configuration, it should be retained during web application upgrades. Therefore, when comparing the first and second difference results, only the portion of the first difference result that differs from the second difference result needs to be used as the third difference result. Upgrading the low-version JSON string containing personal configurations based on the third difference result achieves the transformation of the web application from a low-version to a high-version version.

[0112] Exemplary System

[0113] Figure 2 This is a schematic diagram of the structure of a system for comparing JSON differences during web application upgrades according to a preferred embodiment of the present invention. Figure 2 As shown, the system for comparing JSON differences during web application upgrades according to this preferred embodiment includes:

[0114] The character acquisition unit 201 is used to acquire the JSON string of the web application to be upgraded. The JSON string is data describing the layout and controls on the page template of the web application to be upgraded. The JSON string includes a high-version JSON string of the web application to be upgraded, an original low-version JSON string, and a low-version JSON string containing personal configuration.

[0115] The character parsing unit 202 is used to parse the high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration into a first JSONObject, a second JSONObject, and a third JSONObject, respectively.

[0116] The text conversion unit 203 is used to describe the elements in the first JSONObject, the second JSONObject, and the third JSONObject using key-value pairs, wherein the element refers to each comma-separated part of the first JSONObject, the second JSONObject, and the third JSONObject, and the key-value pair refers to the name and value of the element;

[0117] The first comparison unit 204 is used to compare the key-value pairs in the first JSONObject and the second JSONObject to generate a first difference result; and

[0118] The second comparison unit 205 is used to compare the key-value pairs in the second JSONObject and the third JSONObject to generate a second difference result;

[0119] The third comparison unit 206 is used to compare the first difference result and the second difference result to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded.

[0120] The first, second, and third difference results include predefined identifiers describing the difference type.

[0121] Preferably, the character parsing unit 202 uses any one of the FASTJSON package, GSON package, and NET.SF.JSON package to parse the high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration into a first JSONObject, a second JSONObject, and a third JSONObject, respectively.

[0122] Preferably, the text conversion unit 203 describes the elements in the first JSONObject, the second JSONObject, and the third JSONObject using key-value pairs, including:

[0123] When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects, the element is parsed into a first-level child node. The internal elements of the first-level child node are then parsed until a simple value is read. Finally, the key name of the key-value pair is the name of each level child node concatenated with dots, and the key value is a simple value, which includes string, number, boolean, and null.

[0124] When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONArrays, if the elements in the JSONArray are simple values, the key name of the final key-value pair is the JSONArray name concatenated in [], and the key value is a simple value; if the elements in the JSONArray are JSONObjects, each element in the JSONArray is first determined by concatenating the JSONArray name with [key-value pairs with unique names in the JSONArray], and then parsed and generated as a final key-value pair according to the method used when the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects.

[0125] Preferably, the system further includes an identifier definition unit for defining an identifier representing a difference type, the identifier including:

[0126] The first identifier is used to indicate that when the two final key-value pairs being compared have the same key name and the key values ​​corresponding to the key names are both simple values, the key values ​​of the two key-value pairs have changed.

[0127] The second identifier is used to indicate that the two final key-value pairs being compared are such that the element name of the JSONObject appended to the key name of one final key-value pair does not exist in the key name of the other final key-value pair.

[0128] The third identifier is used to represent the two final key-value pairs being compared. The key name of a final key-value pair is the JSONArray name concatenated with the part "[key-value pairs with unique names in the JSONArray]". The key-value pairs with unique names in the JSONArray have the same key name but different key values.

[0129] Preferably, the first comparison unit 204 compares the key-value pairs in the first JSONObject and the second JSONObject to generate a first difference result, including:

[0130] Each final key-value pair in the first JSONObject is compared with all final key-value pairs in the second JSONObject in the order of key name first, then key value. Similarly, each final key-value pair in the second JSONObject is compared with all final key-value pairs in the first JSONObject in the order of key name first, then key value.

[0131] When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is the first identifier, a difference record is generated, denoted as key name: (first identifier)origin the key value of the final key-value pair in the second JSONObject actual the key value of the final key-value pair in the first JSONObject;

[0132] When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is a second identifier, a difference record is generated, denoted as: (second identifier)origin NotFound actual The key value of the final key-value pair in the first JSONObject, or: (second identifier)origin The key value of the final key-value pair in the second JSONObject actual NotFound, wherein the duplicate key name refers to the common part of the key name of the final key-value pair in the first JSONObject and the final key-value pair in the second JSONObject;

[0133] When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is a third identifier, a difference record is generated, denoted as the duplicate key name: (third identifier)|uKey: key name of the key-value pair with a unique name in the JSONArray|origin[key value of the key-value pair with a unique name in the JSONArray of the second JSONObject]actual[key value of the key-value pair with a unique name in the JSONArray of the first JSONObject];

[0134] The set of all difference records is denoted as the first difference result.

[0135] Preferably, the second comparison unit 205 compares the key-value pairs in the second JSONObject and the third JSONObject to generate a second difference result, including:

[0136] Each final key-value pair in the second JSONObject is compared with all final key-value pairs in the third JSONObject in the order of key name first, then key value; and each final key-value pair in the third JSONObject is compared with all final key-value pairs in the second JSONObject in the order of key name first, then key value.

[0137] When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is the first identifier, a difference record is generated, denoted as key name: (first identifier)origin the key value of the final key-value pair in the second JSONObject actual the key value of the final key-value pair in the third JSONObject;

[0138] When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is the second identifier, a difference record is generated, denoted as the duplicate key name: (second identifier)originNotFound actualThe key value of the final key-value pair in the third JSONObject, or (second identifier)originThe key value of the final key-value pair in the second JSONObjectactualNotFound, where the duplicate key name refers to the common part of the key name of the final key-value pair in the second JSONObject and the final key-value pair in the third JSONObject;

[0139] When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is a third identifier, a difference record is generated, denoted as the duplicate key name: (third identifier)|uKey: key name of the key-value pair with a unique name in the JSONArray|origin[key value of the key-value pair with a unique name in the JSONArray of the second JSONObject]actual[key value of the key-value pair with a unique name in the JSONArray of the third JSONObject];

[0140] The set of all difference records is denoted as the second difference result.

[0141] Preferably, the third comparison unit 206 compares the first difference result and the second difference result to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded, including:

[0142] Remove all difference records in the first difference result that are identical to those in the second difference result;

[0143] Remove all difference records in the first difference result that have the same key name but different key values, using the identifier of the difference type as the first identifier and the key name as the first identifier.

[0144] The remaining difference record of the first difference result is recorded as the third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded.

[0145] The preferred embodiment of the system for comparing JSON differences during web application upgrades parses JSON strings of different versions of the web application into JSONObjects, describes them using key-value pairs, and generates difference results by comparing the key-value pairs. This system is used for the precise upgrade of web applications containing JSON strings with personal configurations. The steps are the same as those of the method for comparing JSON differences during web application upgrades, and the technical effects are also the same, so they will not be repeated here.

[0146] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.

[0147] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For system embodiments, since they largely correspond to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0148] The block diagrams of devices, apparatuses, devices, and systems disclosed herein are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.

[0149] The methods and apparatus of this disclosure may be implemented in many ways. For example, they may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order of steps for the methods is for illustrative purposes only, and the steps of the methods of this disclosure are not limited to the order specifically described above unless otherwise specifically stated. Furthermore, in some embodiments, this disclosure may also be implemented as a program recorded on a recording medium, the program including machine-readable instructions for implementing the methods according to this disclosure. Thus, this disclosure also covers recording media storing programs for performing the methods according to this disclosure.

[0150] It should also be noted that in the apparatus, devices, and methods of this disclosure, the components or steps are decomposable and / or recombinable. Such decomposition and / or recombination should be considered equivalent to the present disclosure. The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.

[0151] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.

Claims

1. A method for comparing JSON differences during web application upgrades, characterized in that, The method includes: Define an identifier representing the difference type, the identifier including: The first identifier is used to indicate that when the two final key-value pairs being compared have the same key name and the key values ​​corresponding to the key names are both simple values, the key values ​​of the two key-value pairs have changed. The second identifier is used to indicate that the two final key-value pairs being compared are such that the element name of the JSONObject appended to the key name of one final key-value pair does not exist in the key name of the other final key-value pair. The third identifier is used to represent the two final key-value pairs being compared. The key name of a final key-value pair is the JSONArray name concatenated with the part "[key-value pairs with unique names in the JSONArray]". The key-value pairs with unique names in the JSONArray have the same key name but different key values. Obtain the JSON string of the web application to be upgraded, wherein the JSON string is data describing the layout and controls on the page template of the web application to be upgraded, and the JSON string includes the high version JSON string of the web application to be upgraded, the original low version JSON string, and the low version JSON string containing personal configuration. The high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration are respectively parsed and transformed into a first JSONObject, a second JSONObject, and a third JSONObject; The elements in the first JSONObject, the second JSONObject, and the third JSONObject are all described using key-value pairs, where each element refers to a comma-separated part of the first JSONObject, the second JSONObject, and the key-value pair refers to the name and value of the element; The key-value pairs in the first JSONObject and the second JSONObject are compared to generate a first difference result, including: Each final key-value pair in the first JSONObject is compared with all final key-value pairs in the second JSONObject in the order of key name first, then key value. Similarly, each final key-value pair in the second JSONObject is compared with all final key-value pairs in the first JSONObject in the order of key name first, then key value. When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is the first identifier, a difference record is generated, denoted as key name: (first identifier) ​​origin the key value of the final key-value pair in the second JSONObject actual the key value of the final key-value pair in the first JSONObject; When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is a second identifier, a difference record is generated, denoted as a duplicate key name: (second identifier) ​​origin NotFound actual key value of the final key-value pair in the first JSONObject, or (second identifier) ​​origin key value of the final key-value pair in the second JSONObject actual NotFound, wherein the duplicate key name refers to the common part of the key name of the final key-value pair in the first JSONObject and the final key-value pair in the second JSONObject; When the identifier of the difference type between the final key-value pair in the first JSONObject and a final key-value pair in the second JSONObject is a third identifier, a difference record is generated, denoted as the duplicate key name: (third identifier) ​​|uKey: key name of the key-value pair with a unique name in the JSONArray ||origin [key value of the key-value pair with a unique name in the JSONArray of the second JSONObject]actual [key value of the key-value pair with a unique name in the JSONArray of the first JSONObject]; The set of all difference records is denoted as the first difference result; and The key-value pairs in the second JSONObject and the third JSONObject are compared to generate a second difference result; The first difference result and the second difference result are compared to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded; The first, second, and third difference results include predefined identifiers describing the difference type.

2. The method according to claim 1, characterized in that, The high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration are parsed and transformed into a first JSONObject, a second JSONObject, and a third JSONObject, respectively, using any one of the FASTJSON package, GSON package, and NET.SF.JSON package.

3. The method according to claim 1, characterized in that, Elements in the first JSONObject, second JSONObject, and third JSONObject are all described using key-value pairs, including: When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects, the element is parsed into a first-level child node. The internal elements of the first-level child node are then parsed until a simple value is read. The final key-value pair has the key name of each level child node as a structure concatenated with dots, and the key value is a simple value, which includes string, number, boolean, and null. When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONArrays, if the elements in the JSONArray are simple values, the key name of the final key-value pair is the JSONArray name concatenated in [], and the key value is a simple value; if the elements in the JSONArray are JSONObjects, each element in the JSONArray is first determined by concatenating the JSONArray name with [key-value pairs with unique names in the JSONArray], and then parsed and generated as a final key-value pair according to the method used when the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects.

4. The method according to claim 1, characterized in that, The key-value pairs in the second JSONObject and the third JSONObject are compared to generate a second difference result, including: Each final key-value pair in the second JSONObject is compared with all final key-value pairs in the third JSONObject in the order of key name first, then key value; and each final key-value pair in the third JSONObject is compared with all final key-value pairs in the second JSONObject in the order of key name first, then key value. When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is the first identifier, a difference record is generated, denoted as key name: (first identifier) ​​origin the key value of the final key-value pair in the second JSONObject actual the key value of the final key-value pair in the third JSONObject; When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is the second identifier, a difference record is generated, denoted as the duplicate key name: (second identifier) ​​origin NotFound actual The key value of the final key-value pair in the third JSONObject, or (second identifier) ​​origin The key value of the final key-value pair in the second JSONObject actual NotFound, wherein the duplicate key name refers to the part that is the same in the key name of the final key-value pair in the second JSONObject and the final key-value pair in the third JSONObject; When the identifier of the difference type between the final key-value pair in the second JSONObject and a final key-value pair in the third JSONObject is a third identifier, a difference record is generated, denoted as the duplicate key name: (third identifier) ​​|uKey: Key name of the key-value pair with a unique name in the JSONArray ||origin [key value of the key-value pair with a unique name in the JSONArray of the second JSONObject]actual [key value of the key-value pair with a unique name in the JSONArray of the third JSONObject]; The set of all difference records is denoted as the second difference result.

5. The method according to claim 4, characterized in that, The first difference result and the second difference result are compared to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded, including: Remove all difference records in the first difference result that are identical to those in the second difference result; Remove all difference records in the first difference result and the second difference result where the identifier of the difference type is the first identifier, the key name is the same, and the key value is different. The remaining difference record of the first difference result is recorded as the third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded.

6. A system for comparing JSON differences when performing web application upgrades using any one of claims 1 to 5, characterized in that, The system includes: The character acquisition unit is used to acquire the JSON string of the web application to be upgraded. The JSON string is data describing the layout and controls on the page template of the web application to be upgraded. The JSON string includes a high-version JSON string of the web application to be upgraded, an original low-version JSON string, and a low-version JSON string containing personal configuration. The character parsing unit is used to parse the high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration into a first JSONObject, a second JSONObject, and a third JSONObject, respectively. The text conversion unit is used to describe the elements in the first JSONObject, the second JSONObject, and the third JSONObject using key-value pairs, wherein the element refers to each comma-separated part of the first JSONObject, the second JSONObject, and the third JSONObject, and the key-value pair refers to the name and value of the element; The first comparison unit is used to compare the key-value pairs in the first JSONObject and the second JSONObject to generate a first difference result; and The second comparison unit is used to compare the key-value pairs in the second JSONObject and the third JSONObject to generate a second difference result; The third comparison unit is used to compare the first difference result and the second difference result to generate a third difference result for upgrading the low-version JSON string containing personal configuration of the web application to be upgraded. The first, second, and third difference results include predefined identifiers describing the difference type.

7. The system according to claim 6, characterized in that, The character parsing unit uses any one of the FASTJSON package, GSON package, and NET.SF.JSON package to parse the high-version JSON string, the original low-version JSON string, and the low-version JSON string containing personal configuration into a first JSONObject, a second JSONObject, and a third JSONObject, respectively.

8. The system according to claim 7, characterized in that, The text conversion unit describes the elements in the first JSONObject, the second JSONObject, and the third JSONObject using key-value pairs, including: When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects, the element is parsed into a first-level child node. The internal elements of the first-level child node are then parsed until a simple value is read. The final key-value pair has the key name of each level child node as a structure concatenated with dots, and the key value is a simple value, which includes string, number, boolean, and null. When the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONArrays, if the elements in the JSONArray are simple values, the key name of the final key-value pair is the JSONArray name concatenated in [], and the key value is a simple value; if the elements in the JSONArray are JSONObjects, each element in the JSONArray is first determined by concatenating the JSONArray name with [key-value pairs with unique names in the JSONArray], and then parsed and generated as a final key-value pair according to the method used when the elements in the first JSONObject, second JSONObject, and third JSONObject are JSONObjects.