Data processing method and device, storage medium and electronic equipment

By retrieving the key field from the target path address of the JSON data, extracting the target data, and generating a report, the problem of slow JSON data report generation speed in existing technologies is solved, thus improving efficiency.

CN116361333BActive Publication Date: 2026-01-23NEUSOFT CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211506672.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-28
Publication Date
2026-01-23
Estimated Expiration
2042-11-28

AI Technical Summary

Technical Problem

In existing technologies, the process of creating reports based on JSON data is slow, time-consuming, and inefficient.

Method used

By obtaining the JSON data to be used, the key fields in the target path address are determined, and the target data is extracted from the JSON data based on the key fields to generate the target report.

Benefits of technology

It improves the efficiency of data identification and report generation, and shortens the time required to generate the target report.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116361333B_ABST
    Figure CN116361333B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a data processing method, device, storage medium and electronic equipment. The data processing method comprises: obtaining to-be-used JSON data, the to-be-used JSON data comprising one or more levels of key-value pairs; obtaining a data processing instruction, the data processing instruction comprising a target path address of target data to be extracted, the target path address being formed by a key field in the one or more levels of key-value pairs; extracting the target data according to nesting level information of the key field in the to-be-used JSON data; and generating a target report according to the target data and a specified key field of the target path address. In this way, the target data can be determined according to the key field in the data processing instruction, and the target report can be generated according to the target data and the specified key field of the target path address, which can effectively improve the data determination efficiency, and in turn can effectively improve the report generation efficiency and shorten the time required for generating the target report from the to-be-used JSON data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a data processing method, apparatus, storage medium, and electronic device. Background Technology

[0002] When creating reports, in addition to using database data sources, it's common to encounter the need to retrieve data using REST (Representational State Transfer) interfaces. The data returned by REST interfaces is mostly in JSON (JavaScript Object Notation) structure. Currently, the process of creating reports based on JSON data typically suffers from slow speed, long processing times, and low efficiency. Summary of the Invention

[0003] The purpose of this disclosure is to provide a data processing method, apparatus, storage medium, and electronic device.

[0004] To achieve the above objectives, the first aspect of this disclosure provides a data processing method, the method comprising:

[0005] Obtain the JSON data to be used, which includes key-value pairs at one or more levels;

[0006] Obtain data processing instructions, the data processing instructions including the target path address of the target data to be extracted, the target path address being formed by the key field in one or more levels of key-value pairs;

[0007] Based on the nesting hierarchy information of the key field in the JSON data to be used, extract the target data from the JSON data to be used;

[0008] Generate a target report based on the target data and the specified key field of the target path address.

[0009] Optionally, the method further includes:

[0010] The target preview data is determined based on the JSON data to be used, and the target preview data includes the nesting level information;

[0011] Display the target preview data;

[0012] The data acquisition and processing instructions include:

[0013] Obtain the execution command and the target path address input by the user based on the displayed target preview data;

[0014] The data processing instruction is generated based on the execution instruction and the target path address.

[0015] Optionally, determining the target preview data based on the JSON data to be used includes:

[0016] From the JSON data to be used, determine the specified JSON data corresponding to the key-value pair with the highest nesting level;

[0017] Use the specified JSON data as the target preview data.

[0018] Optionally, extracting the target data based on the nesting hierarchy information of the key field in the JSON data to be used includes:

[0019] Determine one or more value elements corresponding to the innermost key field of the target path address from the JSON data to be used;

[0020] Use the one or more value elements as the target data.

[0021] Optionally, determining one or more value elements corresponding to the innermost key field of the target path address from the JSON data to be used includes:

[0022] If the target path address includes key fields at multiple levels, determine one or more strings corresponding to the key fields at each level from the JSON data to be used;

[0023] Each string corresponding to the innermost key field in the target path address is used as the value element to obtain one or more value elements corresponding to the innermost key field.

[0024] Optionally, determining one or more strings corresponding to the key fields of each level from the JSON data to be used includes:

[0025] If the string corresponding to the key field is a JSON array, then the string in each JSON object in the JSON array is used as the string corresponding to the key field.

[0026] Optionally, generating the target report based on the specified key field of the target data and the target path address includes:

[0027] The specified key field is used as the table header, and the value element corresponding to the innermost key field of the target path address is stored in the specified cell under the table header to obtain the target report.

[0028] A second aspect of this disclosure provides a data processing apparatus, the apparatus comprising:

[0029] The first acquisition module is configured to acquire JSON data to be used, the JSON data to be used including key-value pairs at one or more levels;

[0030] The second acquisition module is configured to acquire data processing instructions, the data processing instructions including the target path address of the target data to be extracted, the target path address being formed by key fields in one or more levels of key-value pairs;

[0031] The extraction module is configured to extract the target data from the JSON data to be used based on the nesting level information of the key field in the JSON data to be used;

[0032] The generation module is configured to generate a target report based on a specified key field of the target data and the target path address.

[0033] Optionally, the device further includes:

[0034] The determination module is configured to determine target preview data based on the pending JSON data, wherein the target preview data includes the nesting hierarchy information;

[0035] The display module is configured to display the target preview data;

[0036] The second acquisition module is configured as follows:

[0037] Obtain the execution command and the target path address input by the user based on the displayed target preview data;

[0038] The data processing instruction is generated based on the execution instruction and the target path address.

[0039] Optionally, the determining module is configured to:

[0040] From the JSON data to be used, determine the specified JSON data corresponding to the key-value pair with the highest nesting level;

[0041] Use the specified JSON data as the target preview data.

[0042] Optionally, the extraction module is configured as follows:

[0043] Determine one or more value elements corresponding to the innermost key field of the target path address from the JSON data to be used;

[0044] Use the one or more value elements as the target data.

[0045] Optionally, the extraction module is configured as follows:

[0046] If the target path address includes key fields at multiple levels, determine one or more strings corresponding to the key fields at each level from the JSON data to be used;

[0047] Each string corresponding to the innermost key field in the target path address is used as the value element to obtain one or more value elements corresponding to the innermost key field.

[0048] Optionally, the extraction module is configured as follows:

[0049] If the string corresponding to the key field is a JSON array, then the string in each JSON object in the JSON array is used as the string corresponding to the key field.

[0050] Optionally, the generation module is configured as follows:

[0051] The specified key field is used as the table header, and the value element corresponding to the innermost key field of the target path address is stored in the specified cell under the table header to obtain the target report.

[0052] A third aspect of this disclosure provides a non-transitory computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in the first aspect above.

[0053] A fourth aspect of this disclosure provides an electronic device, comprising:

[0054] A memory on which computer programs are stored;

[0055] A processor for executing the computer program in the memory to implement the steps of the method described in the first aspect above.

[0056] The above technical solution involves: acquiring JSON data to be used, which includes key-value pairs at one or more levels; acquiring data processing instructions, which include the target path address of the target data to be extracted, the target path address being formed by key fields in key-value pairs at one or more levels; extracting the target data from the JSON data to be used based on the nesting hierarchy information of the key fields in the JSON data to be used; and generating a target report based on the target data and the specified key fields of the target path address. This allows for the determination of target data based on the key fields in the data processing instructions, and the generation of a target report based on the target data and the specified key fields of the target path address. This effectively improves data determination efficiency, thereby improving report generation efficiency and shortening the time required to generate a target report from the JSON data to be used.

[0057] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0058] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation thereof. In the drawings:

[0059] Figure 1 This is a flowchart illustrating a data processing method according to an exemplary embodiment of this disclosure;

[0060] Figure 2 It is based on Figure 1 The illustrated embodiment shows a flowchart of a data processing method;

[0061] Figure 3 This is a flowchart illustrating a data processing method in another exemplary embodiment of this disclosure;

[0062] Figure 4 This is a block diagram illustrating a data processing apparatus according to an exemplary embodiment of the present disclosure;

[0063] Figure 5 Based on this disclosure Figure 4 The illustrated embodiment shows a block diagram of a data processing apparatus;

[0064] Figure 6 This is a block diagram illustrating an electronic device according to an exemplary embodiment;

[0065] Figure 7 This is a block diagram illustrating another electronic device according to an exemplary embodiment. Detailed Implementation

[0066] The specific embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit this disclosure.

[0067] It should be noted that all actions involving the acquisition of signals, information, or data in this disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the location is situated, and with authorization from the owner of the relevant device.

[0068] Before detailing the specific implementation methods of this disclosure, the application scenarios of this disclosure are first explained as follows: This disclosure can be applied to scenarios where reports are generated based on JSON data. Currently, in the process of generating reports based on JSON data, determining the data in each cell requires a relatively complete parsing of the JSON data. For example, when generating reports based on the following JSON data (ds1)...

[0069] During the process of Table 1:

[0070]

[0071]

[0072] Table 1

[0073]

[0074]

[0075] When determining the data in each cell of Table 1, parsing must begin from the start of the code until the corresponding data is obtained. For example, when determining "HP region", the path executed is: payload→domainInfo→provinces→"name":"LN province"→"citys"→"name":"SY city"→"regions"→"name":"HP region"; when determining "TX region", the path executed is: payload→domainInfo→provinces→"name":"LN province"→"citys"→"name":"SY city"→"regions"→"name":"TX region". Since determining the data in each cell requires a relatively complete parsing of the JSON data from the beginning, the current process of creating reports based on JSON structured data is prone to problems such as slow report creation speed, long processing time, and low efficiency.

[0076] To address the aforementioned technical problems, this disclosure provides a data processing method, apparatus, storage medium, and electronic device. The data processing method involves: acquiring pending JSON data, which includes key-value pairs at one or more levels; acquiring a data processing instruction, which includes a target path address for the target data to be extracted, the target path address being formed by key fields in the key-value pairs at one or more levels; extracting the target data from the pending JSON data based on the nesting hierarchy information of the key fields in the pending JSON data; and generating a target report based on the target data and a specified key field of the target path address. This allows for the determination of target data based on the key fields in the data processing instruction, and the generation of a target report based on the target data and the specified key field of the target path address, effectively improving data determination efficiency and thus report generation efficiency, and shortening the time required to generate the target report from the pending JSON data.

[0077] The technical solution of this disclosure will be described in detail below with reference to specific embodiments.

[0078] Figure 1 This is a flowchart illustrating a data processing method according to an exemplary embodiment of this disclosure; as shown below. Figure 1 As shown, the method may include:

[0079] Step 101: Obtain the JSON data to be used, which includes key-value pairs at one or more levels.

[0080] The JSON data to be used can include multiple levels of JSON objects, which can be JSON arrays. A JSON object contains at least one key-value pair, and a JSON array can contain multiple JSON objects.

[0081] It should be noted that in this step, the URL (uniform resource locator) address corresponding to the JSON data to be used can be entered. This URL address can include a fixed URL corresponding to the data source storing the JSON data to be used, as well as variable parameters required to obtain the JSON data to be used. These variable parameters can be the search keywords set for the JSON data to be used when creating a new data source. It should also be noted that the process of creating a new data source is a mature technology in the prior art, and this disclosure does not limit it.

[0082] Step 102: Obtain a data processing instruction, which includes the target path address of the target data to be extracted. The target path address is formed by the key field in one or more levels of key-value pairs.

[0083] The data processing instructions can be obtained through user input, such as through a preset input interface, preset input window, or preset input box. These instructions consist of an execution instruction and a target path address. The execution instruction can be a select instruction, a group instruction, or a get instruction, or other instructions representing an action. The select instruction displays all value elements (including duplicate value elements) corresponding to the innermost field of the target path address. The group instruction groups all value elements corresponding to the innermost field of the target path address by (removing duplicates) and then displays them; the displayed data consists of value elements with a certain order and no duplicates. The get instruction retrieves all value elements corresponding to the innermost field of the target path address. The target path address can be formed by a key field with a hierarchical order. For example, using the JSON data in ds1 above, the target path address could be:

[0084] 'payload.domainInfo.provinces.name',

[0085] 'payload.domainInfo.provinces.citys.name' or

[0086] 'payload.domainInfo.provinces.citys.regions.name'.

[0087] In the target path address above, payload, domainInfo, provinces, cities, regions, and name are key fields in key-value pairs at different levels. The name field is the key field in the string corresponding to the adjacent key field in the target path address. The level of a later-sorted key field in the target path address is within the level of a earlier-sorted key field; for example, in 'payload.domainInfo.provinces.name', payload is the outermost key field, and name is the innermost key field.

[0088] For example: In Table 1 above, to retrieve the data in the first column, you can enter the data processing command: group('ds1','payload.domainInfo.provinces.name'); to retrieve the data in the second column, you can enter the data processing command: select('ds1','payload.domainInfo.provinces.citys.name'); to retrieve the data in the third column, you can enter the data processing command:

[0089] The command `select('ds1','payload.domainInfo.provinces.citys.regions.name')` can quickly retrieve Table 1 from the JSON data in 'ds1'. It's important to note that 'ds1' is the name of the dataset or JSON data, and the string following 'ds1' is the target path address within 'ds1', indicating that the command retrieves data from 'ds1' according to that target path address.

[0090] Step 103: Extract the target data from the JSON data to be used based on the nesting level information of the key field in the JSON data to be used.

[0091] In this step, the nesting level information can be the nesting relationships between objects, objects and arrays, and arrays and objects in the JSON data to be used, which can be determined by the data format in the JSON data. Additionally, one or more value elements corresponding to the innermost key field of the target path address can be determined from the JSON data to be used; these one or more value elements are then used as the target data.

[0092] Figure 2 It is based on Figure 1 The illustrated embodiment presents a flowchart of a data processing method. The method described above, which determines one or more value elements corresponding to the innermost key field of the target path address from the JSON data to be used, may include... Figure 2 The steps shown in S1 and S2 are as follows: Figure 2 As shown:

[0093] S1, if the target path address includes key fields at multiple levels, determine one or more strings corresponding to the key fields at each level from the JSON data to be used.

[0094] In this step, if the string corresponding to the key field is a JSON array, the string in each JSON object in the JSON array will be used as the string corresponding to the key field.

[0095] For example, in the case of a target path address of 'payload.domainInfo.provinces.name', the string corresponding to the key field payload is a JSON array, which is [{"id":"abc","domainInfo":{"provinces":[{"name":"LN province","citys":[{"name":"SY city""regions":[{"name":"HP district""value":""},{"name":"TX district""value"]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]} ] "" " ""}" "" " """""`"})]]]]]]]]]]]]]]]]]]]]]]]] " "" ""'"""'"""""" "" ... {"name":"DL City"regions":[{"name":"ZS District"value":""},{"name":"XG District"value":""}]}]},{"name":"HB Province","citys":[{"name":"SJZ City"regions":[{"name":"XH District"value":""}]},{"name":"TS City"regions":[{"name":"LN District"value":""}]}]}}]}]}];

[0096] The string corresponding to the key field domainInfo is a part of the string corresponding to the key field payload, namely "domainInfo": {"provinces":[{"name":"LN province","citys":[{"name":"SY city","regions":[{"name":"HP district","value":""},{"name":"TX district","value":""}]},{"name":"DL city","regions":[{"name":"ZS district","value":""},{"name":"XG district","value":""}]}]},{"name":"HB province","citys":[{"name":"SJZ city","regions":[{"name":"XH district","value":""}]},{"name":"TS city","regions":[{"name":"LN district","value":""}]}]}]};

[0097] The string corresponding to the key field "provinces" is a part of the string corresponding to the key field "domainInfo", that is, [{"name":"LN province", "city":[{"name":"SY city", "regions":[{"name":"HP district", "value":""}, {"name":"TX district", "value":""}]}, {"name":"DL city", "regions":[{"name":"ZS district", "value":""}, {"name":"XG district", "value":""}]}]}, {"name":"HB province", "city":[{"name":"SJZ city", "regions":[{"name":"XH district", "value":""}]}, {"name":"TS city", "regions":[{"name":"LN district", "value":""}]}]}}];

[0098] Taking the key field "provinces" as an example, the string corresponding to the key field "provinces" is a JSON array. This JSON array includes two nested JSON objects. One JSON object is: {"name":"LN province", "citys":[{"name":"SY city", "regions":[{"name":"HP district", "value":""}, {"name":"TX district", "value":""}]}, {"name":"DL city", "regions":[{"name":"ZS district", "value":""}, {"name":"XG district", "value":""}]}]}; the other JSON object is: {"name":"HB province", "citys":[{"name":"SJZ city", "regions":[{"name":"XH district", "value":""}]}, {"name":"TS city", "regions":[{"name":"LN district", "value":""}]}]}}. Since the JSON array corresponding to the key field "provinces" contains two nested JSON objects, the strings in these two nested JSON objects are the strings corresponding to the key "provinces".

[0099] S2, use each string corresponding to the innermost key field in the target path address as the value element to obtain one or more value elements corresponding to the innermost key field.

[0100] Taking the example shown in step S1 as an example, the innermost key field of the target path address 'payload.domainInfo.provinces.name' is 'name'. Therefore, the string corresponding to the outermost 'name' of the two strings corresponding to 'provinces' in the key field can be used as the value element corresponding to the innermost key field in the target path address. That is, the value elements "LN province" and "HB province" in "name":"LN province" and "name":"HB province" are used as the value elements corresponding to the innermost key field 'name' in 'payload.domainInfo.provinces.name', thus obtaining the target data corresponding to 'payload.domainInfo.provinces.name'.

[0101] Step 104: Generate a target report based on the target data and the specified key field of the target path address.

[0102] In this step, the specified key field can be used as the table header, and the value element corresponding to the innermost key field in the target path address can be stored in the specified cell under the table header to obtain the target report.

[0103] In one implementation, the specified key field can be the second-level key field in the target path address. For example, provinces in 'payload.domainInfo.provinces.name' can be used as the specified table header, citys in 'payload.domainInfo.provinces.citys.name' can be used as the table header. Another example is that regions in 'payload.domainInfo.provinces.citys.regions.name' can be used as the table header, and the value elements corresponding to provinces.name, citys.name, and regions.name are used as the data in the cells of the corresponding columns (or rows) respectively to obtain the target report as shown in Table 2.

[0104] Table 2

[0105]

[0106] In another implementation, the specified key field can be the second-level key field in the target path address. The language type of the second-level key field in the target path address can be determined. When the language type is not the specified language type, the text of the specified language type corresponding to the second-level key field can be obtained and used as the table header. For example, when the specified language type is Chinese and the second-level key fields are provinces, citys, and regions, the Chinese texts corresponding to provinces, citys, and regions, namely, province, city, and district, can be obtained, thus generating a target report with province, city, and district as the table headers, as shown in Table 3.

[0107] Table 3

[0108]

[0109]

[0110] The above technical solution can determine the target data based on the key field in the data processing instruction. The target data includes one or more value elements, meaning that a column (or row) of data can be obtained through a single data processing instruction. Therefore, it can effectively improve the efficiency of determining the data in the cell when creating reports based on JSON data. Furthermore, since the target report can be directly generated based on the specified key field of the target data and the target path address, it can also effectively improve the automation of report creation, thereby improving the efficiency of report generation and shortening the time required to generate the target report based on the JSON data to be used.

[0111] Figure 3 This is a flowchart illustrating a data processing method as shown in another exemplary embodiment of this disclosure; such as Figure 3 As shown, the method may include:

[0112] Step 301: Obtain the JSON data to be used, which includes key-value pairs at one or more levels.

[0113] Step 302: Determine the target preview data based on the JSON data to be used. The target preview data includes the nesting level information.

[0114] In this step, the specified JSON data corresponding to the key-value pair with the highest nesting level can be determined from the JSON data to be used; this specified JSON data is then used as the target preview data.

[0115] It should be noted that the target preview data can be a JSON data with a specified code format. This specified code format can be that characters at the same level are vertically aligned, and characters at different levels are indented to the right by different distances. By previewing the JSON data with this specified code format, users can quickly read the hierarchical information of the JSON data to be used. For example, if the target preview data is the JSON data 'ds1' mentioned above, users can quickly read the nested hierarchical information between payload.domainInfo.provinces.citys.regions, that is, regions∈citys∈provinces∈domainInfo∈payload.

[0116] In this step, the number of nesting levels in the JSON data can be determined by the code format of the JSON data. In one implementation, the number of different indentation distances can be counted. For example, if there are 5 indentation distances, then there are 5 nesting levels. In another implementation, since the same level of "{}" is located in a vertically aligned column, from the left to the right of the program, the further to the left, the outermost level, and the further to the right, the innermost level. Therefore, the first number of "{}" characters (excluding JSON arrays) from the outermost to the innermost level can be counted, and the second number of "{}" characters from the outermost to the innermost level can be counted. The sum of the first and second numbers can be used as the nesting level in the JSON data.

[0117] Step 303: Display the preview data of the target.

[0118] It should be noted that displaying a preview of the target data in this step helps users quickly read the hierarchical information of the JSON data to be used.

[0119] Step 304: Obtain the execution command and target path address input by the user based on the displayed target preview data. The target path address is formed by the key field in one or more levels of key-value pairs.

[0120] The execution command can be a select command, a group command, or a get command. The select command displays all value elements (including duplicate value elements) corresponding to the innermost field of the target path address; the group command displays value elements that are ordered and non-repeating after grouping by the innermost field of the target path address; the get command retrieves all value elements corresponding to the innermost field of the target path address. The target path address can be formed by a key field with hierarchical order. For example, using the JSON data in ds1 above, the target path address could be:

[0121] 'payload.domainInfo.provinces.name',

[0122] 'payload.domainInfo.provinces.citys.name' or

[0123] 'payload.domainInfo.provinces.citys.regions.name'.

[0124] In the target path address above, payload, domainInfo, provinces, cities, regions, and name are key fields in key-value pairs at different levels. The name field is the key field in the string corresponding to the adjacent key field in the target path address. The level of a later-sorted key field in the target path address is within the level of the earlier-sorted key field. For example, in 'payload.domainInfo.provinces.name', payload is the outermost key field, and name is the innermost key field.

[0125] In this step, an input interface for data processing instructions can be pre-set. The user-inputted execution instruction and target path address can be obtained through this input interface. This input interface can be an input interface, an input window, or an input box, or other input interfaces in the prior art.

[0126] Step 305: Generate the data processing instruction based on the execution instruction and the target path address.

[0127] In this step, the execution instruction and the target path address can be concatenated according to a preset format to obtain the data processing instruction.

[0128] For example, the target path address 'payload.domainInfo.provinces.name' in ds1 is concatenated with the group specification to form group('ds1','payload.domainInfo.provinces.name').

[0129] Step 306: Determine one or more value elements corresponding to the innermost key field of the target path address from the JSON data to be used.

[0130] It should be noted that the implementation method for this step can be found in [reference needed]. Figure 2 The relevant descriptions of S1 and S2 are not repeated here.

[0131] Step 307: Use the one or more value elements as the target data.

[0132] Step 308: Use the specified key field as the table header, and store the value element corresponding to the innermost key field of the target path address into the specified cell under the table header to obtain the target report.

[0133] The specified cell can be the cell containing the specified row or column, and the specified key field can be the innermost key field in the target path address.

[0134] For example, the first column of data can be retrieved by entering the data processing command `group('ds1','payload.domainInfo.provinces.name')`, and the second column of data can be retrieved by entering the data processing command `group('ds1','payload.domainInfo.provinces.citys.name')`.

[0135] The `SELECT('ds1','payload.domainInfo.provinces.citys.regions.name')` statement retrieves the data from the second column. It then uses `provinces` from `payload.domainInfo.provinces.name` as the specified header, and `citys` from `payload.domainInfo.provinces.citys.name` as the header. For example, it can use `regions` from `payload.domainInfo.provinces.citys.regions.name` as the header, and use the values ​​corresponding to `provinces.name`, `citys.name`, and `regions.name` as the data in the cells of the corresponding columns (or rows) to obtain the report shown in Table 4 below.

[0136] Table 4

[0137]

[0138] The above technical solution first displays target preview data with hierarchical nesting information to the user, then obtains the execution command and target path address input by the user based on the displayed target preview data. The target path address is formed by the key fields in one or more levels of key-value pairs. The target data is determined according to the key fields in the data processing command. The target data includes one or more value elements. In this way, a column (or row) of data can be obtained through a data processing command, which can effectively improve the efficiency of determining the data in the cell when creating reports based on JSON data. Furthermore, since the target report can be directly generated based on the target data and the specified key fields of the target path address, it can also effectively improve the automation of report creation, which is conducive to improving the efficiency of report generation and shortening the time to generate the target report from the JSON data to be used.

[0139] Figure 4 This is a block diagram illustrating a data processing apparatus according to an exemplary embodiment of the present disclosure; as shown below. Figure 4 As shown, the device may include:

[0140] The first acquisition module 401 is configured to acquire pending JSON data, which includes key-value pairs at one or more levels;

[0141] The second acquisition module 402 is configured to acquire a data processing instruction, which includes the target path address of the target data to be extracted, the target path address being formed by key fields in one or more levels of key-value pairs;

[0142] Extraction module 403 is configured to extract the target data from the JSON data to be used based on the nesting level information of the key field in the JSON data to be used;

[0143] The generation module 404 is configured to generate a target report based on the target data and a specified key field of the target path address.

[0144] The above technical solution can determine the target data based on the key field in the data processing instruction, and generate the target report based on the target data and the specified key field of the target path address. This can effectively improve the efficiency of data determination, thereby effectively improving the efficiency of report generation and shortening the time to generate the target report based on the JSON data to be used.

[0145] Figure 5 Based on this disclosure Figure 4 The illustrated embodiment shows a block diagram of a data processing apparatus; as shown Figure 5 As shown, the device also includes:

[0146] Module 405 is configured to determine target preview data based on the pending JSON data, the target preview data including the nesting hierarchy information;

[0147] Display module 406 is configured to display preview data of the target;

[0148] The second acquisition module 402 is configured as follows:

[0149] Obtain the execution command and target path address input by the user based on the displayed target preview data;

[0150] The data processing instruction is generated based on the execution instruction and the target path address.

[0151] Optionally, the determining module 405 is configured as follows:

[0152] From the JSON data to be used, determine the specified JSON data corresponding to the key-value pair with the highest nesting level;

[0153] Use the specified JSON data as the preview data for this target.

[0154] Optionally, the extraction module 403 is configured as follows:

[0155] From the JSON data to be used, determine one or more value elements corresponding to the innermost key field of the target path address;

[0156] Use one or more value elements as the target data.

[0157] Optionally, the extraction module 403 is configured as follows:

[0158] If the target path address includes key fields at multiple levels, determine one or more strings corresponding to the key fields at each level from the JSON data to be used;

[0159] Each string corresponding to the innermost key field in the target path address is used as the value element to obtain one or more value elements corresponding to the innermost key field.

[0160] Optionally, the extraction module 403 is configured as follows:

[0161] If the string corresponding to the key field is a JSON array, then the string in each JSON object of that JSON array will be used as the string corresponding to the key field.

[0162] Optionally, the generation module 404 is configured as follows:

[0163] Use the specified key field as the table header, and store the value element corresponding to the innermost key field of the target path address into the specified cell under the table header to obtain the target report.

[0164] The above technical solution first displays target preview data with hierarchical nesting information to the user, then obtains the execution command and target path address input by the user based on the displayed target preview data. The target path address is formed by the key fields in one or more levels of key-value pairs. The target data is determined according to the key fields in the data processing command. The target data includes one or more value elements. In this way, a column (or row) of data can be obtained through a data processing command, which can effectively improve the efficiency of determining the data in the cell when creating reports based on JSON data. Furthermore, since the target report can be directly generated based on the target data and the specified key fields of the target path address, it can also effectively improve the automation of report creation, which is conducive to improving the efficiency of report generation and shortening the time to generate the target report from the JSON data to be used.

[0165] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0166] Figure 6 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Figure 6 As shown, the electronic device 700 may include a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input / output (I / O) interface 704, and a communication component 705.

[0167] The processor 701 controls the overall operation of the electronic device 700 to complete all or part of the steps in the data processing method described above. The memory 702 stores various types of data to support the operation of the electronic device 700. This data may include, for example, instructions for any application or method operating on the electronic device 700, and application-related data such as contact data, sent and received messages, pictures, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The multimedia component 703 may include a screen and audio components. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 702 or transmitted via communication component 705. The audio component also includes at least one speaker for outputting audio signals. I / O interface 704 provides an interface between processor 701 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IoT, eMTC, or other 5G technologies, or combinations thereof, is not limited here. Therefore, the corresponding communication component 705 may include: a Wi-Fi module, a Bluetooth module, an NFC module, etc.

[0168] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the data processing method described above.

[0169] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the data processing method described above. For example, the computer-readable storage medium may be the memory 702 including program instructions described above, which may be executed by the processor 701 of the electronic device 700 to complete the data processing method described above.

[0170] Figure 7 This is a block diagram illustrating another electronic device according to an exemplary embodiment. For example, electronic device 1900 may be provided as a server. (Refer to...) Figure 7 The electronic device 1900 includes a processor 1922, which may be one or more, and a memory 1932 for storing computer programs executable by the processor 1922. The computer program stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processor 1922 may be configured to execute the computer program to perform the data processing methods described above.

[0171] Additionally, the electronic device 1900 may also include a power supply component 1926 and a communication component 1950. The power supply component 1926 can be configured to perform power management of the electronic device 1900, and the communication component 1950 can be configured to enable communication of the electronic device 1900, such as wired or wireless communication. Furthermore, the electronic device 1900 may also include an input / output (I / O) interface 1958. The electronic device 1900 can operate on an operating system stored in memory 1932.

[0172] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the data processing method described above. For example, the non-transitory computer-readable storage medium may be the memory 1932 including the program instructions described above, which may be executed by the processor 1922 of the electronic device 1900 to complete the data processing method described above.

[0173] In another exemplary embodiment, a computer program product is also provided, which includes a computer program executable by a programmable device, the computer program having a code portion for performing the data processing method described above when executed by the programmable device.

[0174] The preferred embodiments of this disclosure have been described in detail above with reference to the accompanying drawings. However, this disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this disclosure, various simple modifications can be made to the technical solutions of this disclosure, and these simple modifications all fall within the protection scope of this disclosure.

[0175] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.

[0176] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.

Claims

1. A data processing method, characterized in that, The method includes: Obtain the JSON data to be used, which includes key-value pairs at one or more levels; Obtain data processing instructions, the data processing instructions including the target path address of the target data to be extracted, the target path address being formed by the key field in one or more levels of key-value pairs; Based on the nesting hierarchy information of the key field in the JSON data to be used, extract the target data from the JSON data to be used; Generate a target report based on the specified key field of the target data and the target path address; The method further includes: The target preview data is determined based on the JSON data to be used, and the target preview data includes the nesting level information; Display the target preview data; The data acquisition and processing instructions include: Obtain the execution command and the target path address input by the user based on the displayed target preview data; The data processing instruction is generated based on the execution instruction and the target path address.

2. The data processing method according to claim 1, characterized in that, The step of determining the target preview data based on the JSON data to be used includes: From the JSON data to be used, determine the specified JSON data corresponding to the key-value pair with the highest nesting level; Use the specified JSON data as the target preview data.

3. The data processing method according to claim 1, characterized in that, The step of extracting the target data based on the nesting hierarchy information of the key field in the JSON data to be used includes: Determine one or more value elements corresponding to the innermost key field of the target path address from the JSON data to be used; Use the one or more value elements as the target data.

4. The data processing method according to claim 3, characterized in that, The step of determining one or more value elements corresponding to the innermost key field of the target path address from the JSON data to be used includes: If the target path address includes key fields at multiple levels, determine one or more strings corresponding to the key fields at each level from the JSON data to be used; Each string corresponding to the innermost key field in the target path address is used as the value element to obtain one or more value elements corresponding to the innermost key field.

5. The data processing method according to claim 4, characterized in that, The step of determining one or more strings corresponding to the key fields of each level from the JSON data to be used includes: If the string corresponding to the key field is a JSON array, then the string in each JSON object in the JSON array is used as the string corresponding to the key field.

6. The data processing method according to any one of claims 1-5, characterized in that, The step of generating the target report based on the specified key field of the target data and the target path address includes: The specified key field is used as the table header, and the value element corresponding to the innermost key field of the target path address is stored in the specified cell under the table header to obtain the target report.

7. A data processing apparatus, characterized in that, The device includes: The first acquisition module is configured to acquire JSON data to be used, the JSON data to be used including key-value pairs at one or more levels; The second acquisition module is configured to acquire data processing instructions, the data processing instructions including the target path address of the target data to be extracted, the target path address being formed by key fields in one or more levels of key-value pairs; The extraction module is configured to extract the target data from the JSON data to be used based on the nesting level information of the key field in the JSON data to be used; The generation module is configured to generate a target report based on a specified key field of the target data and the target path address; The device further includes: The determination module is configured to determine target preview data based on the pending JSON data, wherein the target preview data includes the nesting hierarchy information; The display module is configured to display the target preview data; The second acquisition module is configured as follows: Obtain the execution command and the target path address input by the user based on the displayed target preview data; The data processing instruction is generated based on the execution instruction and the target path address.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1-6.

9. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Data processing method and device

    CN109766100A

  • Data format conversion method and system, medium and electronic equipment

    CN110222008A