JSON data display method and device, equipment, medium and program product

By hierarchical processing and tabular display of JSON data, it solves the problem that non-professional users find it difficult to interpret JSON data, realizes the readability and accessibility of the data, and improves the efficiency of data utilization.

CN120407564APending Publication Date: 2025-08-01CHONGQING JINKANG NEW ENERGY VEHICLE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510499090.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-21
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

It is difficult for non-professional technical users to effectively interpret JSON data, which affects the effective use of data and decision-making.

Method used

By hierarchically processing the JSON data, converting it into a table form, using the key value as the table header, the value value as the table content, and setting a jump control to achieve hierarchical display of the data.

Benefits of technology

It improves the readability and accessibility of JSON data, allowing non-professional users to intuitively understand the data content, and promotes the effective use of data and decision-making.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407564A_ABST
    Figure CN120407564A_ABST
Patent Text Reader

Abstract

The invention discloses a JSON data display method and device, equipment, a medium and a program product, and relates to the technical field of computers.The method comprises the steps that firstly, jth-level content of ith content of JSON data to be displayed is determined, whether the value type of the jth-level content is an object or not is judged, if the value type of the jth-level content is the object, a key value of the ith content serves as an ith header value of a jth-level table, and if the value type of the jth-level content is the object, the jth-level table serves as the ith header value of the jth-level table; whether the value format corresponding to the key value of the ith content is a JSON format or not is judged, if yes, the ith table value of the jth-level table is set as the ith jump control, the (j + 1) th-level content of the ith content of the JSON data to be displayed is determined, if not, the value value of the ith content serves as the ith table value of the jth-level table, and then the jth-level content of the jth-level table is displayed. And determining a target table according to the header value and the table value of each level, and finally displaying the target table. According to the method, non-professional technical users can visually see the JSON data, and the readability of the JSON data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a method, device, equipment, medium and program product for displaying JSON data. Background Art

[0002] JSON (JavaScript Object Notation) is a lightweight data interchange format and is widely used in the fields of programming and data transmission due to its high efficiency and readability.

[0003] However, for some non-professional technical users, JSON data poses a barrier to understanding. These users lack the necessary professional knowledge and technical background and are difficult to effectively interpret the content in JSON data, thus affecting the effective utilization of data and the decision-making process.

[0004] Therefore, how to provide a friendly and intuitive way to display JSON data for non-professional technical users has become an urgent problem to be solved. Summary of the Invention

[0005] This application provides a method, device, equipment, medium and program product for displaying JSON data, which can provide a friendly and intuitive way to display JSON data for non-professional technical users and improve the readability of JSON data.

[0006] To achieve the above object, this application adopts the following technical solutions: In a first aspect, this application provides a method for displaying JSON data. The method is applied to a processing device and includes: Determine the j-th level content of the i-th content of the JSON data to be displayed; Judge whether the value type of the j-th level content of the i-th content is an object; If the value type of the j-th level content of the i-th content is an object, use the key value of the i-th content as the i-th header value of the j-th level table; Judge whether the value format corresponding to the key value of the i-th content is in JSON format; If the value format corresponding to the key value of the i-th content is in JSON format, set the i-th table value of the j-th level table as the i-th jump control. The i-th jump control is used to jump to the i-th table value interface and determine the (j + 1)-th level content of the i-th content of the JSON data to be displayed; If the value format corresponding to the key value of the i-th piece of content is not in JSON format, use the value of the i-th piece of content as the i-th table value in the j-th level table, where the i-th table header value in the j-th level table corresponds to the i-th table value. Determine the target table based on the table header values and table values at each level. Display the target table.

[0007] In some possible implementation manners, the method further includes: If the value type of the value of the j-th level content of the i-th piece of content is not an object, determine whether the value type of the value of the j-th level content of the i-th piece of content is an array. If the value type of the value of the j-th level content of the i-th piece of content is an array, use the key value of the i-th piece of content as the i-th table header value in the j-th level table, and set the i-th table value in the j-th level table to the i-th jump control. Determine whether the value format corresponding to the key value of the i-th piece of content is in JSON format. If the value format corresponding to the key value of the i-th piece of content is in JSON format, determine the (j + 1)-th level content of the i-th piece of content of the JSON data to be displayed. If the value format corresponding to the key value of the i-th piece of content is not in JSON format, set the i-th table value in the j-th level table to the i-th jump control, and determine the target table based on the table header values and table values at each level. Display the target table.

[0008] In some possible implementation manners, the method further includes: If the value type of the value of the j-th level content of the i-th piece of content is not an array, display a prompt message for prompting that the JSON data to be displayed is not standard data.

[0009] In some possible implementation manners, the method further includes: In response to a trigger operation on the jump control in the target table, display the table value interface corresponding to the jump control.

[0010] In some possible implementation manners, the determination of whether the value format corresponding to the key value of the i-th piece of content is in JSON format includes: Obtain the value type corresponding to the key value of the i-th piece of content. If the value type corresponding to the key value of the i-th piece of content is an object or an array, determine that the value format corresponding to the key value of the i-th piece of content is in JSON format; If the value type corresponding to the key value of the i-th piece of content is neither an object nor an array, determine that the value format corresponding to the key value of the i-th piece of content is not in JSON format.

[0011] In some possible implementation manners, the method further includes: Obtain a display request, where the data display request includes an identifier of JSON data; Obtain the JSON data to be displayed according to the identifier of the JSON data.

[0012] In a second aspect, the present application provides a display device for JSON data, including: A determination module, configured to determine the j-th level content of the i-th piece of content of the JSON data to be displayed; A judgment module, configured to judge whether the value type of the value of the j-th level content of the i-th piece of content is an object; if the value type of the value of the j-th level content of the i-th piece of content is an object, use the key value of the i-th piece of content as the i-th table header value of the j-th level table; judge whether the value format corresponding to the key value of the i-th piece of content is in JSON format; if the value format corresponding to the key value of the i-th piece of content is in JSON format, set the i-th table value of the j-th level table as the i-th jump control, where the i-th jump control is used to jump to the i-th table value interface, and determine the (j + 1)-th level content of the i-th piece of content of the JSON data to be displayed; if the value format corresponding to the key value of the i-th piece of content is not in JSON format, use the value of the i-th piece of content as the i-th table value of the j-th level table, where the i-th table header value of the j-th level table corresponds to the i-th table value, and determine a target table according to the table header values and table values of each level; A display module, configured to display the target table.

[0013] In a third aspect, the present application provides a computing device, including a memory and a processor; Wherein, one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the computing device is enabled to execute the method according to any one of the first aspect.

[0014] Fourthly, the present application provides a computer-readable storage medium for storing a computer program, which is used to execute the method described in any one of the first aspect.

[0015] Fifthly, the present application provides a computer program product, which includes one or more computer instructions. When the computer instructions are executed by a computer, the computer executes the method described in any one of the first aspect.

[0016] As can be seen from the above technical solutions, the present application has at least the following beneficial effects: The present application provides a method for displaying JSON data. In this method, first, the j-th level content of the i-th content of the JSON data to be displayed is determined, and it is judged whether the value type of the j-th level content of the i-th content is an object. If the value type of the j-th level content of the i-th content is an object, the key value of the i-th content is used as the i-th table header value of the j-th level table. Then, it is judged whether the value format corresponding to the key value of the i-th content is a JSON format. If the value format corresponding to the key value of the i-th content is a JSON format, the i-th table value of the j-th level table is set as the i-th jump control for jumping to the i-th table value interface, and the (j + 1)-th level content of the i-th content of the JSON data to be displayed is determined. If the value format corresponding to the key value of the i-th content is not a JSON format, the value of the i-th content is used as the i-th table value of the j-th level table, where the i-th table header value and the i-th table value of the j-th level table correspond to each other. According to the table header values and table values of each level, a target table is determined, and finally, it is displayed. In the traditional solution, the JSON data does not perform hierarchical processing on different data, and all the JSON data is arranged word by word in the input order on the computer page. Professional technical users can directly read the JSON data when browsing it, but non-professional technical users are difficult to understand when browsing the JSON data because non-technical personnel lack the necessary professional knowledge and technical background and are difficult to effectively interpret the data content in the JSON structure, thus affecting the effective utilization of data and the decision-making process. It can be seen that by converting the JSON data and performing hierarchical processing on the JSON data, the present application obtains the JSON data in the form of a table, which helps non-professional technical users to intuitively view the JSON data and improves the readability of the JSON data.

[0017] It should be understood that the descriptions of technical features, technical solutions, beneficial effects or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. On the contrary, it can be understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and beneficial effects described in this embodiment can be combined in any appropriate manner. Those skilled in the art will understand that an embodiment can be implemented without one or more specific technical features, technical solutions or beneficial effects of a specific embodiment. In other embodiments, additional technical features and beneficial effects can also be identified in specific embodiments that do not embody all embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application; Figure 2 A schematic diagram of an unordered code provided by an embodiment of the present application; Figure 3 A flowchart of a method for displaying JSON data provided by an embodiment of the present application; Figure 4 A schematic diagram of the code of JSON data provided by an embodiment of the present application; Figure 5 A schematic diagram of the tabular form of JSON data provided by an embodiment of the present application; Figure 6 A schematic diagram of simultaneous display in two regions provided by an embodiment of the present application; Figure 7 Another schematic diagram of the tabular form of JSON data provided by an embodiment of the present application; Figure 8 A schematic diagram of a device for displaying JSON data provided by an embodiment of the present application; Figure 9 A schematic diagram of a computing device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0019] The terms "first", "second", "third", etc. in the specification and drawings of this application are used to distinguish different objects, rather than to limit a specific order.

[0020] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific manner.

[0021] Currently, JSON data does not hierarchically classify various types of information, but directly and continuously displays all data on the computer screen in the order of input. For users with professional skills, they can directly read and understand JSON data; however, for non-professional technical users, due to the lack of necessary professional knowledge and technical background, they may feel confused when browsing JSON data and it is difficult to effectively parse the information contained in the data structure. This situation may lead to the underutilization of data, thereby affecting the accuracy and efficiency of decision-making.

[0022] In view of this, the embodiments of the present application provide a method for displaying JSON data. This method can be applied to a processing device, which can be a terminal or a server. The terminal includes but is not limited to a smart phone, a tablet computer, a laptop computer, a personal digital assistant, or a smart wearable device, etc. The server can be a cloud server, such as the central server in a central cloud computing cluster or the edge server in an edge cloud computing cluster. Of course, the server can also be a server in a local data center. A local data center refers to a data center directly controlled by the user. In this method, by converting and hierarchically processing the JSON data, it can be transformed into tabular JSON data. This tabular display method can clearly present the hierarchical structure and logical relationship of the data, enabling non-professional technical users to intuitively view and understand the content of the JSON data, thereby improving the readability and accessibility of the JSON data and contributing to the effective utilization of data and the accuracy of decision-making.

[0023] To make the technical solutions of the present application clearer and easier to understand, the application scenarios of the technical solutions of the present application will be introduced below with reference to the accompanying drawings. As Figure 1 shown, this figure is a schematic diagram of an application scenario provided by the embodiments of the present application.

[0024] In this application scenario, user 101 accesses and obtains JSON data through the browser interface 102 on the terminal device. This JSON data originally exists in the form of unordered key-value pairs, such as Figure 2As shown in the figure, this is a schematic diagram of an unordered code provided by an embodiment of the present application. It can be seen from the figure that the code is arranged in a section on the page. To improve readability and usability, in the present application, it is converted into a table form and displayed on the browser interface through the JSON data tabular component 103. The function of this JSON data tabular component 103 is to convert complex JSON data into a more intuitive and understandable table form, enabling users to view and analyze data content more conveniently.

[0025] The browser interface 102 includes a first area 104 and a second area 105. The first area 104 is set as the main display area, specifically for presenting the tabular data that has been converted by the JSON data tabular component 103. Such a design allows users to directly browse the hierarchical distribution of data in the table and quickly obtain key information, such as the names and values of data items and their relationships. The second area 105 serves as an auxiliary display area, and its function is to display the original, unconverted tree-shaped JSON data. This display method preserves the original structure of the JSON data, including nested levels, the relationship between objects and arrays, etc., which is very useful for professional technical users who need to deeply understand the data structure or conduct debugging. Through the second area 105, users can clearly see how the data is organized and the logical relationships between various parts, which helps them trace back to the source of data processing for more in-depth analysis or correction when necessary.

[0026] When the user browses, they can switch between the first area 104 and the second area 105 and vice versa through the first switching control 106. This facilitates the user to read the JSON data, enabling non-professional technical users to intuitively see and understand the content of the JSON data, thereby improving the readability and accessibility of the JSON data and contributing to the effective utilization of data and the accuracy of decision-making.

[0027] To make the technical solution of the present application clearer and easier to understand, the following describes a method for displaying JSON data provided by an embodiment of the present application in combination with the above application scenario. As Figure 3 shown in the figure, this is a flowchart of a method for displaying JSON data provided by an embodiment of the present application. The method for displaying this JSON data includes: S301. The processing device determines the j-th level content of the i-th content of the JSON data to be displayed.

[0028] For the convenience of subsequent description of the method for displaying JSON data, as Figure 4As shown, this figure is a schematic diagram of the code of a JSON data provided by an embodiment of the present application. In the figure, the code data of a JSON data is provided to provide data content for subsequent examples.

[0029] The JSON data contains multiple pieces of content, and each piece of content contains content at different levels. In the present application, it is set that the JSON data contains M pieces of content, and each piece of content contains 1 to N levels of content. It is set that the processing device needs to display the content at the j-th level of the i-th piece of content in the JSON data, where i is less than or equal to M and i is a positive integer; j is less than or equal to N and j is a positive integer.

[0030] In Figure 4 it can be seen that the processing device can detect the JSON data to determine whether a colon is detected. If a colon is detected, it continues to determine whether the left parenthesis of the parentheses (including the small parenthesis, the middle parenthesis, and the large parenthesis) is detected. If the left parenthesis of the parentheses is not detected but a comma is detected, the first word before the colon and the content between the colon and the comma are taken as a piece of content; if after detecting the colon, the left parenthesis of the parentheses is detected, it continues to detect the right parenthesis that matches the left parenthesis of the parentheses, and then determines whether a comma is after the right parenthesis. If a comma is after the right parenthesis, the first word before the colon and the content between the colon and the comma are taken as a piece of content; where the content between the left parenthesis and the right parenthesis is the content at the next level of this piece of content, and the detection method described above is used for the content at the next level for detection.

[0031] S302. The processing device determines whether the value type of the content at the j-th level of the i-th piece of content is an object.

[0032] An object in JSON data is a composite value that can combine multiple values (which can be primitive values or objects) together and can access these values by name. In the JavaScript language, an object is an unordered collection of key-value pairs. The key in each key-value pair is a string, and the value can be any data type.

[0033] If the processing device wants to convert the JSON data into a table form, it first needs to determine whether the value type of the content at the j-th level of the i-th piece of content in the JSON data is an object.

[0034] Exemplarily, in the present application, the Object.prototype.toString.call method is used for judgment. First, the value of the j-th level content of the i-th content in the JSON data is parsed to obtain a first string, and it is judged whether the first string is equal to the first target string [object Object]. If the first string is equal to the first target string [object Object], it is considered that the value type of the j-th level content of the i-th content in the JSON data is an object; if the first string is not equal to the first target string [object Object], it is considered that the value type of the j-th level content of the i-th content in the JSON data is not an object.

[0035] If the value type of the j-th level content of the i-th content is an object, then S303 is executed; If the value type of the j-th level content of the i-th content is not an object, then S304 is executed.

[0036] Among them, using the Object.prototype.toString.call method to judge the value type of the j-th level content of the i-th content in the JSON data is only one embodiment in the present application. There are various methods to judge the value type of the j-th level content of the i-th content in the JSON data. The present application only selects one of them as an example for introduction. However, the present application is not limited to this specific method, but covers all other methods or variants that can achieve the same or similar functional effects.

[0037] S303. The processing device uses the key value of the i-th content as the i-th table header value of the j-th level table.

[0038] If the value type of the j-th level content of the i-th content is an object, the processing device uses the key value of the i-th content as the i-th table header value of the j-th level table.

[0039] Exemplarily, set i = 1 and j = 1. It can be seen in Figure 4 that the first-level content of the first content is name: 'John Doe', and the value type is an object. Therefore, the processing device uses the key value name of the first content as the first table header value of the first-level table. To make the method clearer and easier to understand, the present application provides a schematic diagram in the form of a table of JSON data, such as Figure 5As shown in the figure, this is a schematic diagram of a table form of JSON data provided by an embodiment of the present application. It can be seen from the figure that the breadcrumb navigation bar 501 can be used to help users navigate, facilitating users to know which level this interface is in. The interface can also be switched and displayed through the second switching control 502.

[0040] In some embodiments, when the first area 104 displays JSON data, the user browses the first level of the first piece of content. When the user clicks the second switching control 502 to switch to the second area 105, it will be seen that the level where name: 'John Doe' is located in the second area 105 is highlighted. To make the method clearer and easier to understand, the present application provides a schematic diagram of simultaneous display of two areas, as Figure 6 shown in the figure, this is a schematic diagram of simultaneous display of two areas provided by an embodiment of the present application.

[0041] Next, S309 is executed again.

[0042] S304. The processing device determines whether the value type of the content at the j-th level of the i-th piece of content is an array.

[0043] If the value type of the content at the j-th level of the i-th piece of content is not an object, then it is determined whether the value type of the content at the j-th level of the i-th piece of content is an array. Among them, an array in JSON data is an ordered collection of values and is used to store an ordered collection.

[0044] Exemplarily, in the present application, the Object.prototype.toString.call method is used for determination. First, the value of the content at the j-th level of the i-th piece of content in the JSON data is parsed to obtain a second string, and it is determined whether the second string is equal to the second target string [object Array]. If the second string is equal to the second target string [object Array], it is considered that the value type of the content at the j-th level of the i-th piece of content in the JSON data is an object; if the second string is not equal to the second target string [object Array], it is considered that the value type of the content at the j-th level of the i-th piece of content in the JSON data is not an object.

[0045] If the value type of the content at the j-th level of the i-th piece of content is an array, then S305 is executed; If the value type of the content at the j-th level of the i-th piece of content is not an array, then S308 is executed; S305. The processing device uses the key value of the i-th piece of content as the i-th table header value of the j-th level table, and sets the i-th table value of the j-th level table as the i-th jump control.

[0046] If the value type of the content at the j-th level of the i-th content is an array, the processing device uses the key value of the i-th content as the i-th table header value of the j-th level table, and sets the i-th table value of the j-th level table as the i-th jump control.

[0047] Exemplarily, setting i = 5 and j = 1, in Figure 4 it can be seen that the content at the 1st level of the 5th content is hobbies: ['reading', 'hiking', 'coding'], and the value type is an array. Therefore, the processing device uses the key value hobbies of the 5th content as the 5th table header value of the 1st level table. As Figure 5 shown, the 5th table value of the 1st level table is set as the 5th jump control, that is, the fifth jump control.

[0048] Next, S306 is executed.

[0049] S306. The processing device determines whether the value format corresponding to the key value of the i-th content is in JSON format.

[0050] If the value type corresponding to the key value of the i-th content is an object (usually represented by curly braces "{}") or an array (usually represented by square brackets "[]"), then the processing device determines that the value corresponding to the key value of the i-th content conforms to JSON format. This is because in JSON data, objects and arrays are the most basic and commonly used data structures, which can flexibly represent various complex data relationships.

[0051] However, if the processing device determines that the value type is neither an object nor an array, but other types (such as strings, numbers, booleans, or null, etc.), then the processing device determines that the value does not conform to JSON format. Such a judgment is based on the basic rules of JSON data, that is, only objects and arrays can be regarded as valid JSON structures.

[0052] Among them, for the specific method of determining whether it is an object or an array, the above judgment method can be referred to, and it will not be elaborated here.

[0053] Through such a judgment process, the processing device can accurately identify whether the value corresponding to the key value in each content conforms to JSON format, so as to ensure that the subsequent data processing and display processes can proceed smoothly. This step is crucial for maintaining the accuracy and consistency of data and is also a key link in realizing efficient data processing and display.

[0054] Moreover, it is determined whether the value format corresponding to the key value of the i-th content is in JSON format, with the aim of performing a detailed split of the JSON data and displaying each piece of data in the JSON data in a table for the convenience of non-professional technical users to read.

[0055] If the value format corresponding to the key value of the i-th content is in JSON format, then S301 is returned in the form of j + 1; if the value format corresponding to the key value of the i-th content is not in JSON format, then S307 is executed.

[0056] In the case where the value format corresponding to the key value of the i-th content is in JSON format, the processing device determines the (j + 1)-th level content of the i-th content of the JSON data to be displayed.

[0057] Exemplarily, assume i = 4 and j = 1. In Figure 4 it can be seen that the first-level content of the 4th content is contact: {email: 'john.doe@example.com', phoneNumbers: [{type: 'home', number: '123-456-7890',}, {type: 'work', number: '987-654-3210',},]}. In Figure 5 it can be seen that the key value contact of the 4th content is used as the 4th table header value of the first-level table, and the 4th table value of the first-level table is set as the 4th jump control, that is, the fourth jump control. The 4th jump control is used to jump to the 4th table value interface. Therefore, the processing device determines that the second-level content of the 4th content of the JSON data to be displayed is email: 'john.doe@example.com', phoneNumbers: [{type: 'home', number: '123-456-7890',}, {type: 'work', number: '987-654-3210',},].

[0058] S307. The processing device sets the i-th table value of the j-th level table as the i-th jump control and determines the target table according to the table header values and table values of each level.

[0059] Exemplarily, assume i = 3 and j = 1. In Figure 4It can be seen that the first-level content of the third piece of content is address: {street: '123 Main St', city: 'Anytown', country: 'Countryland'}, and the second-level content is street: '123 Main St', city: 'Anytown', country: 'Countryland'. Therefore, the processing device uses the key value address of the third piece of content as the third header value of the first-level table, and sets the third table value of the first-level table as the third jump control, that is, the third jump control. The third jump control is used to jump to the interface of the third table value, such as Figure 5 As shown, the target table is determined according to the header values and table values of each level. When i and j are other positive integers, the above operations are performed, and finally the complete target table image is obtained.

[0060] S308. The processing device displays a prompt message, which is used to prompt that the JSON data to be displayed is not standard data.

[0061] If the value type of the j-th level content of the i-th piece of content is not an array, the processing device displays a prompt message, which is used to prompt that the JSON data to be displayed is not standard data.

[0062] During the process of processing JSON data, in order to ensure the accuracy and readability of the data, if the value type of the j-th level content of the i-th piece of content does not conform to the expected array type, then the processing device will immediately trigger a display process of a prompt message. This prompt message can not only timely warn the user or system administrator that there is a problem with the JSON data to be displayed currently, but also guide the system administrator to pay attention to and solve this problem. The prompt message will clearly indicate which level (that is, the j-th level of the i-th piece of content) the value type does not conform to the expected array type, and at the same time will attach some suggested solutions, such as checking the data source, modifying the data format or regenerating the JSON data, etc.

[0063] Through such a design, the processing device can not only maintain a high degree of flexibility and accuracy during the data display process, but also effectively improve the data processing efficiency and accuracy of the user or system administrator. Even in the face of non-standard data, it can ensure that the data problem is solved in a timely and effective manner through timely prompts and guidance.

[0064] S309. The processing device determines whether the value format corresponding to the key value of the i-th piece of content is in JSON format.

[0065] After the processing device uses the key value of the i-th piece of content as the i-th table header value of the j-th level table, it then determines whether the value format corresponding to the key value of the i-th piece of content is in JSON format. The determination method is as follows: Obtain the value type corresponding to the key value of the i-th piece of content; If the value type corresponding to the key value of the i-th piece of content is an object or an array, it is determined that the value format corresponding to the key value of the i-th piece of content is in JSON format; If the value type corresponding to the key value of the i-th piece of content is not an object and not an array, it is determined that the value format corresponding to the key value of the i-th piece of content is not in JSON format.

[0066] If the value format corresponding to the key value of the i-th piece of content is in JSON format, execute S310; If the value format corresponding to the key value of the i-th piece of content is not in JSON format, execute S311.

[0067] S310. The processing device sets the i-th table value of the j-th level table as the i-th jump control.

[0068] The i-th jump control is used to jump to the i-th table value interface to determine the (j + 1)-th level content of the i-th piece of content of the JSON data to be displayed; Exemplarily, set i = 3 and j = 1. In Figure 4As can be seen, the first-level content of the third piece of content is address: {street: '123 Main St', city: 'Anytown', country: 'Countryland'}. Then, the key value address of the third piece of content is used as the third header value of the first-level table, and the third table value of the first-level table is set as the third jump control, that is, the third jump control. The third jump control is used to jump to the interface of the third table value. Therefore, the processing device determines that the second-level content of the third piece of content of the JSON data to be displayed is street: '123 Main St', city: 'Anytown', country: 'Countryland'. The key value street of the second-level content is used as the first header value of the second-level table, and the value 123 Main St of the second-level content is used as the first table value of the second-level table. The key value city of the second-level content is used as the second header value of the second-level table, and the value Anytown of the second-level content is used as the second table value of the second-level table. The key value country of the second-level content is used as the third header value of the second-level table, and the value Countryland of the second-level content is used as the third table value of the second-level table. To make the method clearer and easier to understand, the present application provides another schematic diagram of the table form of the JSON data, as Figure 7 shown. This figure is another schematic diagram of the table form of the JSON data provided by the embodiment of the present application.

[0069] Then return S301 in the form of j + 1.

[0070] S311. The processing device uses the value of the i-th piece of content as the i-th table value of the j-th level table, and determines the target table according to the header values and table values of each level.

[0071] The processing device performs hierarchical processing on each piece of content according to the above steps. The processing device will first determine the key value of each piece of content and use these key values as the header values of the corresponding level tables. Further analyze the value corresponding to each key value. According to the type of the value and its position in the data hierarchy, determine its specific position in the table, and then obtain the header values and table values of each level, and input them in the table in turn to obtain the target table. Among them, the i-th header value of the j-th level table corresponds to the i-th table value, because the processing device will ensure that each header value matches a corresponding table value, and these values accurately reflect the information in the original data.

[0072] Through such a hierarchical processing and table construction process, the processing device can finally generate a target table with a clear structure and accurate data. This target table not only intuitively displays the hierarchical structure and relationships of the original data, but also provides convenient data query and analysis functions. Whether for professional technical users or non-professional technical users, this target table can help them better understand and utilize JSON data.

[0073] S312. The processing device displays the target table.

[0074] The processing device displays the target table according to the user's instruction, and according to the user's operation, in response to the triggering operation on the jump control in the target table, displays the table value interface corresponding to the jump control.

[0075] Exemplarily, if the user needs to know the information of the 3rd content, they can find the corresponding table value according to the header value of the 3rd content in the browser interface, click the third jump control, and jump to the second-level content of the 3rd content, where the corresponding data content can be seen, such as Figure 5 shown.

[0076] Based on the above content, the processing device first determines the j-th level content of the i-th content of the JSON data to be displayed, determines whether the value type of the j-th level content of the i-th content is an object. If the value type of the j-th level content of the i-th content is an object, then takes the key value of the i-th content as the i-th header value of the j-th level table, and then determines whether the value format corresponding to the key value of the i-th content is in JSON format. If the value format corresponding to the key value of the i-th content is in JSON format, then sets the i-th table value of the j-th level table as the i-th jump control for jumping to the i-th table value interface, determines the (j + 1)-th level content of the i-th content of the JSON data to be displayed. If the value format corresponding to the key value of the i-th content is not in JSON format, takes the value of the i-th content as the i-th table value of the j-th level table, where the i-th header value and the i-th table value of the j-th level table correspond to each other. Based on the header values and table values of each level, determines the target table, and finally displays it. It can be seen that through the conversion and hierarchical processing of JSON data in this application, JSON data in a table form is obtained, which helps non-professional technical users to intuitively view JSON data and improves the readability of JSON data.

[0077] As described above in conjunction with Figure 1 A method for displaying JSON data provided by an embodiment of the present application has been introduced in detail. Next, the devices and equipment provided by the embodiments of the present application will be introduced in conjunction with the accompanying drawings.

[0078] As shown Figure 8 in the figure, the figure is a schematic diagram of a JSON data display device provided by an embodiment of the present application. The device includes: a determination module 801, a judgment module 802, and a display module 803; The determination module 801 is configured to determine the j-th level content of the i-th content of the JSON data to be displayed; The judgment module 802 is configured to judge whether the value type of the j-th level content of the i-th content is an object; if the value type of the j-th level content of the i-th content is an object, use the key value of the i-th content as the i-th header value of the j-th level table; judge whether the value format corresponding to the key value of the i-th content is a JSON format; if the value format corresponding to the key value of the i-th content is a JSON format, set the i-th table value of the j-th level table as the i-th jump control, and the i-th jump control is used to jump to the i-th table value interface to determine the (j + 1)-th level content of the i-th content of the JSON data to be displayed; if the value format corresponding to the key value of the i-th content is not a JSON format, use the value of the i-th content as the i-th table value of the j-th level table, where the i-th header value of the j-th level table corresponds to the i-th table value, and determine the target table according to the header values and table values of each level; The display module 803 is configured to display the target table.

[0079] Optionally, the device further includes: if the value type of the j-th level content of the i-th content is not an object, judge whether the value type of the j-th level content of the i-th content is an array; If the value type of the j-th level content of the i-th content is an array, use the key value of the i-th content as the i-th header value of the j-th level table, and set the i-th table value of the j-th level table as the i-th jump control; Judge whether the value format corresponding to the key value of the i-th content is a JSON format; If the value format corresponding to the key value of the i-th content is a JSON format, determine the (j + 1)-th level content of the i-th content of the JSON data to be displayed; If the value format corresponding to the key value of the i-th content is not a JSON format, set the i-th table value of the j-th level table as the i-th jump control, and determine the target table according to the header values and table values of each level; Display the target table.

[0080] Optionally, the device further includes: if the value type of the content at the j-th level of the i-th piece of content is not an array, a prompt message is displayed, and the prompt message is used to prompt that the JSON data to be displayed is not standard data.

[0081] Optionally, the device further includes: in response to a trigger operation on the jump control in the target table, a table value interface corresponding to the jump control is displayed.

[0082] Optionally, the determination module 802 is further configured to determine whether the value format corresponding to the key value of the i-th piece of content is in JSON format, including: Obtain the value type corresponding to the key value of the i-th piece of content; If the value type corresponding to the key value of the i-th piece of content is an object or an array, it is determined that the value format corresponding to the key value of the i-th piece of content is in JSON format; If the value type corresponding to the key value of the i-th piece of content is neither an object nor an array, it is determined that the value format corresponding to the key value of the i-th piece of content is not in JSON format.

[0083] Optionally, the device further includes: obtaining a display request, where the data display request includes an identifier of JSON data; Obtain the JSON data to be displayed according to the identifier of the JSON data.

[0084] A JSON data display device according to an embodiment of the present application can correspondingly execute the methods described in the embodiments of the present application, and the above other operations and / or functions of each module / unit of a JSON data display device are respectively for implementing Figure 3 the corresponding processes of the respective methods in the illustrated embodiments, and for the sake of brevity, they will not be described in detail here.

[0085] An embodiment of the present application further provides a computing device. As Figure 9 shown, this figure is a schematic diagram of a computing device provided by an embodiment of the present application. The computing device 900 includes a bus 901, a processor 902, a communication interface 903, and a memory 904. The processor 902, the memory 904, and the communication interface 903 communicate with each other through the bus 901.

[0086] The bus 901 can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 only a thick line is used in Figure 9 , but it does not mean that there is only one bus or one type of bus.

[0087] The processor 902 can be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0088] The communication interface 903 is used for external communication.

[0089] The memory 904 can include volatile memory, such as random access memory (RAM). The memory 904 can also include non-volatile memory, such as read-only memory (ROM), flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0090] Executable code is stored in the memory 904, and the processor 902 executes the executable code to execute the foregoing method for displaying a JSON data.

[0091] Specifically, in the case of implementing Figure 8 the illustrated embodiment, and Figure 8 when each module or unit of the apparatus for displaying a JSON data described in the embodiment is implemented by software, the software or program code required to execute the functions of each module / unit in Figure 8 can be partially or fully stored in the memory 904. The processor 902 executes the program code corresponding to each unit stored in the memory 904 to execute the foregoing method for displaying a JSON data. Figure 8

[0092] ​The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state drive), etc. The computer-readable storage medium includes instructions that direct the computing device to execute the above-described method for displaying a JSON data.

[0093] The embodiments of the present application also provide a computer program product that includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, they generate, in whole or in part, the processes or functions described in the embodiments of the present application.

[0094] The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, a computer, or a data center to another website, a computer, or a data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line) or a wireless manner (such as infrared, wireless, microwave, etc.).

[0095] When the computer program product is executed by a computer, the computer executes any of the methods for displaying a JSON data described above. The computer program product can be a software installation package. In the case where any of the methods for displaying a JSON data described above is needed, the computer program product can be downloaded and executed on the computer.

[0096] The descriptions of the processes or structures corresponding to the above respective drawings have their own emphases. For parts not detailed in a certain process or structure, reference can be made to the relevant descriptions of other processes or structures.

[0097] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application.

Claims

1. A method for displaying JSON data, characterized in that, The method is applied to a processing device, and the method comprises: Determine the j-th level content of the i-th content of the JSON data to be displayed; Determine whether the value type of the j-th level content of the i-th content is an object; If the value type of the j-level content of the i-th content is an object, use the key value of the i-th content as the i-th header value of the j-level table; Determine whether the value format corresponding to the key value of the i-th content is in JSON format; If the value format corresponding to the key value of the i-th content is in JSON format, set the i-th table value of the j-th level table as the i-th jump control, and the i-th jump control is used to jump to the i-th table value interface, and determine the j+1-th level content of the i-th content of the JSON data to be displayed; If the value format corresponding to the key value of the i-th content is not in JSON format, the value of the i-th content is used as the i-th table value of the j-th level table, wherein the i-th header value of the j-th level table corresponds to the i-th table value, and the target table is determined according to the header values and table values of each level; The target table is displayed.

2. The method according to claim 1, wherein The method further comprises: If the value type of the j-th level content of the i-th content is not an object, determine whether the value type of the j-th level content of the i-th content is an array; If the value type of the j-level content of the i-th content is an array, use the key value of the i-th content as the i-th header value of the j-level table, and set the i-th table value of the j-level table as the i-th jump control; Determine whether the value format corresponding to the key value of the i-th content is in JSON format; If the value format corresponding to the key value of the i-th content is in JSON format, determine the j+1-th level content of the i-th content of the JSON data to be displayed; If the value format corresponding to the key value of the i-th content is not in JSON format, set the i-th table value of the j-th level table as the i-th jump control, and determine the target table based on the header values and table values of each level; The target table is displayed.

3. The method according to claim 2, characterized in that The method further comprises: If the value type of the j-level content of the i-th content is not an array, a prompt message is displayed, where the prompt message is used to indicate that the JSON data to be displayed is not standard data.

4. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: In response to a triggering operation on a jump control in the target table, a table value interface corresponding to the jump control is displayed.

5. The method according to claim 1, wherein The determining whether the value format corresponding to the key value of the i-th content is in JSON format includes: Get the value type corresponding to the key value of the i-th content; If the value type corresponding to the key value of the i-th content is an object or an array, determining that the value format corresponding to the key value of the i-th content is in JSON format; If the value type corresponding to the key value of the i-th content is neither an object nor an array, it is determined that the value format corresponding to the key value of the i-th content is not in JSON format.

6. The method according to claim 1, characterized in that, The method further includes: Obtaining a display request, where the data display request includes an identifier of JSON data; Obtaining the JSON data to be displayed according to the identifier of the JSON data.

7. A display device for JSON data, characterized in that, The device includes: A determination module, configured to determine the j-th level content of the i-th content of the JSON data to be displayed; A judgment module, configured to judge whether the value type of the j-th level content of the i-th content is an object; if the value type of the j-th level content of the i-th content is an object, use the key value of the i-th content as the i-th header value of the j-th level table; judge whether the value format corresponding to the key value of the i-th content is in JSON format; if the value format corresponding to the key value of the i-th content is in JSON format, set the i-th table value of the j-th level table as the i-th jump control, where the i-th jump control is used to jump to the i-th table value interface, and determine the (j + 1)-th level content of the i-th content of the JSON data to be displayed; if the value format corresponding to the key value of the i-th content is not in JSON format, use the value of the i-th content as the i-th table value of the j-th level table, where the i-th header value and the i-th table value of the j-th level table correspond to each other, and determine the target table according to the header values and table values of each level; A display module, configured to display the target table.

8. A computing device, characterized in that Including a memory and a processor; Wherein, one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the computing device is caused to execute the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes one or more computer instructions, and when the computer instructions are executed by a computer, the computer executes the method according to any one of claims 1 to 6.