CN112131839A - Display method and device of JSON data structure - Google Patents

Display method and device of JSON data structure Download PDF

Info

Publication number
CN112131839A
CN112131839A CN202010872684.XA CN202010872684A CN112131839A CN 112131839 A CN112131839 A CN 112131839A CN 202010872684 A CN202010872684 A CN 202010872684A CN 112131839 A CN112131839 A CN 112131839A
Authority
CN
China
Prior art keywords
state
fields
structural data
row
displaying
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010872684.XA
Other languages
Chinese (zh)
Inventor
徐智
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Individual
Original Assignee
Individual
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to CN202010872684.XA priority Critical patent/CN112131839A/en
Publication of CN112131839A publication Critical patent/CN112131839A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • G06F40/154Tree transformation for tree-structured or markup documents, e.g. XSLT, XSL-FO or stylesheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/189Automatic justification

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the invention provides a method and a device for displaying a JSON data structure, wherein the method comprises the following steps: acquiring structural data of at least one state of JSON data; the structural data includes: at least one field stored in a row, each field comprising: a key name and a value corresponding to the key name; and converting the structural data of the first state in the structural data of the at least one state into structural data of a second state and displaying the structural data, wherein the structural data of the second state shows the original structure and content of the JSON data. The scheme of the invention can directly display the JSON original structure and content, and ensure the definition of data display.

Description

Display method and device of JSON data structure
Technical Field
The invention relates to the technical field of data exchange, in particular to a method and a device for displaying a JSON data structure.
Background
JSON (JSON Object Notation) is a lightweight data exchange format. Data is stored and represented in a text format that is completely independent of the programming language. The compact and clear hierarchy makes JSON an ideal data exchange language. The network transmission method is easy to read and write by people, is easy to analyze and generate by machines, and effectively improves the network transmission efficiency.
The currently used data display controls are all based on a row and column structure, namely GRID or TABLE; when JSON data is displayed, forcibly converting the JSON data into a mode with consistent column definition;
typically, the columns used by JSON data are located as a union of the full data column definitions; thus, the original structure of JSON, not displayed directly, is displayed indirectly, affecting the clarity of data display.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a method and a device for displaying a JSON data structure, which can directly display the JSON original structure and content and ensure the definition of data display.
A method of displaying a JSON data structure, the method comprising:
acquiring structural data of at least one state of JSON data; the structural data includes: at least one field stored in a row, each field comprising: a key name and a value corresponding to the key name;
and converting the structural data of the first state in the structural data of the at least one state into structural data of a second state and displaying the structural data, wherein the structural data of the second state shows the original structure and content of the JSON data.
Optionally, the converting the structural data in the first state in the structural data in the at least one state into the structural data in the second state includes:
and converting the fields in each line into the structural data in the second state according to the sequence of the lines and a preset rule.
Optionally, according to the sequence of the rows, converting the fields in each row into the structural data in the second state according to a preset rule, and displaying the structural data, where the structural data includes at least one of the following:
converting the field of the Nth row into structural data of a second state according to the width of a display window, and displaying the structural data;
converting the field of the Nth row into structural data of a second state according to the fixed length of the field, and displaying the structural data;
and converting the field of the Nth row into the structural data of the second state according to the hierarchy of the key name of the field and/or the hierarchy of the value corresponding to the key name, and displaying the structural data.
Optionally, converting the field in the nth row into the structural data in the second state according to the width of the display window, and displaying the structural data, including:
if the display window is converted from the first width to the second width, displaying M1 fields in the M fields of the nth row in the N +1 th row in the display window with the second width in the order from back to front, wherein the nth row in the display window with the second width displays M-M1 fields, and the second width is smaller than the first width; or,
if the display window is converted from the second width to the first width, then in the display window with the first width, the M1 fields in the fields of the (N + 1) th row are displayed in the nth row in the order from front to back, wherein the nth row in the display window with the first width displays M fields, and the second width is smaller than the first width.
Optionally, converting the field in the nth row into the structural data in the second state according to the fixed length of the field, and displaying the structural data, including:
converting the M fields with indefinite length in each row into the fields with fixed length, and displaying the fields in a display window; or
The M fixed-length fields in each row are converted into non-fixed-length fields and displayed in the display window.
Optionally, converting the field in the nth row into the structural data in the second state according to the hierarchy of the key name of the field, and displaying the structural data, including:
expanding the key names in the Nth row into a plurality of levels of fields in a layered manner according to the levels of the key names, and displaying the expanded fields in the display window; or,
and folding the key names in the Nth row into a plurality of hierarchical fields according to the hierarchy of the key names, and displaying the folded fields in the display window.
Optionally, converting the field in the nth row into the structural data in the second state according to the hierarchy of the value corresponding to the key name of the field, and displaying the structural data, including:
taking the value corresponding to the key name in the Nth row as a plurality of levels of fields, expanding the fields in a layered mode according to the level of the value corresponding to the key name, and displaying the expanded fields in the display window; or,
and taking the value corresponding to the key name in the Nth row as fields of a plurality of hierarchies, folding the fields in a layering manner according to the hierarchy of the value corresponding to the key name, and displaying the folded fields in the display window.
Optionally, the display method of the JSON data structure further includes:
displaying at least one function button in the display window; wherein the function buttons include at least one of:
a first button for triggering the display of the fields of each row according to a first state;
a second button for triggering the display of the fields of each row according to a second state;
the third button is used for triggering fields with key names or values corresponding to the key names in multiple levels in each row to be displayed according to a fully-folded state;
the fourth button is used for triggering fields with key names or key names corresponding to multiple levels in each row to be displayed according to a layer-by-layer folding state;
the fifth button is used for triggering fields with key names or key names corresponding to multiple levels in each row to be displayed according to a layer-by-layer expanded state;
a sixth button for triggering display of fields of a plurality of hierarchies of key names or values corresponding to the key names in each row according to a fully expanded state;
the seventh button is used for triggering the key names of the fields in each row to be displayed according to the key name translation result after the preset language translation;
the eighth button is used for triggering the value corresponding to the key name of the field in each row to be displayed according to the translated value translation result of the preset language;
a ninth button having a selected or unselected state, wherein when the ninth button is in the selected state, the unfolded and folded button group is valid for at least one selected row, and when the ninth button is in the unselected state, the unfolded and folded button group is valid for all the rows in the whole world, and the unfolded and folded button group includes at least one of the third button, the fourth button, the fifth button and the sixth button;
a tenth button, configured to screen key names of fields in each row, where a field corresponding to at least one selected key name is normally displayed, and a field of an unselected key name is not displayed;
an eleventh button, configured to screen the key name translation results of the fields in each row, where a field corresponding to at least one selected key name translation result is normally displayed, and a field corresponding to a non-selected key name translation result is not displayed;
a twelfth button for receiving an input value corresponding to the key name to be searched and normally displaying a field corresponding to the searched value;
and the thirteenth button is used for receiving the input value translation result to be searched and normally displaying the field corresponding to the searched value translation result.
An embodiment of the present invention further provides a display device of a JSON data structure, including:
the acquisition module is used for acquiring structural data of at least one state of JSON data; the structural data includes: at least one field stored in a row, each field comprising: a key name and a value corresponding to the key name;
and the processing module is used for converting the structural data of the first state in the structural data of the at least one state into the structural data of the second state and displaying the structural data of the second state, wherein the original structure and the content of the JSON data are displayed by the structural data of the second state.
Embodiments of the present invention also provide a computer-readable storage medium comprising instructions which, when executed on a computer, cause the computer to perform the method as described above.
The above embodiments of the present invention have at least the following technical effects:
according to the scheme, structural data of at least one state of JSON data is obtained; the structural data includes: at least one field stored in a row, each field comprising: a key name and a value corresponding to the key name; and converting the structural data of the first state in the structural data of at least one state into the structural data of the second state and displaying the structural data, wherein the structural data of the second state can directly display the original structure and content of JSON data, and the definition of data display is ensured.
Drawings
FIG. 1 is a schematic flow chart of a method for displaying a JSON data structure according to the present invention;
FIG. 2 is a diagram illustrating automatic wrapping of fields in different windows, in accordance with an embodiment of the present invention;
FIG. 3 is a diagram illustrating conversion of field lengths from indefinite lengths to fixed lengths or from fixed lengths to indefinite lengths, in an embodiment of the present invention;
FIG. 4 is a diagram illustrating Key and Value nested layouts, in an embodiment of the present invention;
FIG. 5 is a diagram of Key corresponding to multiple values in an embodiment of the present invention;
FIG. 6 is a diagram of an embodiment of the present invention, where Key corresponds to multiple values, and each Value is a KeyValue;
FIG. 7 is a schematic diagram of a function button in an embodiment of the present invention;
FIG. 8 is a schematic diagram of Key translation, in an embodiment of the invention;
FIG. 9 is a diagram of Value translation, in an embodiment of the invention;
FIG. 10 is a schematic diagram of selected and unselected function buttons in an embodiment of the invention;
FIG. 11 is a schematic diagram of Key screening or lookup, in an embodiment of the invention;
FIG. 12 is a schematic diagram of Key translation name screening or lookup, in an embodiment of the invention;
FIG. 13 is a diagram of Value lookup and filtering in an embodiment of the invention;
FIG. 14 is a diagram illustrating Value translation lookup and filtering, in accordance with an embodiment of the present invention;
FIG. 15 is a block diagram of a display device of the JSON data structure of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure are described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
As shown in fig. 1, an embodiment of the present invention provides a method for displaying a JSON data structure, where the method includes:
step 11, obtaining structural data of at least one state of JSON data; the structural data includes: at least one field stored in a row, each field comprising: a key name and a value corresponding to the key name; the key name can be represented by an integer and a character string, and the type of the value can be any type, such as any data content displayed on a webpage, and can be pictures, characters, voice, video and the like;
and step 12, converting the structural data of the first state in the structural data of the at least one state into structural data of a second state and displaying the structural data, wherein the structural data of the second state shows the original structure and content of JSON data.
In the embodiment of the invention, the structure data of at least one state of JSON data is obtained; the structural data includes: at least one field stored in a row, each field comprising: a key name and a value corresponding to the key name; and converting the structural data of the first state in the structural data of at least one state into the structural data of the second state and displaying the structural data, wherein the structural data of the second state can directly display the original structure and content of JSON data, and the definition of data display is ensured. Here, the original structure of the JSON data may be a tree structure data type, which is more concise and lightweight.
In an alternative embodiment of the present invention, step 12 may include:
step 121, converting the fields in each row into the structural data in the second state according to the row sequence and the preset rule.
Optionally, step 121 may include at least one of:
1) converting the field of the Nth row into structural data of a second state according to the width of a display window, and displaying the structural data;
2) converting the field of the Nth row into structural data of a second state according to the fixed length of the field, and displaying the structural data;
3) and converting the field of the Nth row into the structural data of the second state according to the hierarchy of the key name of the field and/or the hierarchy of the value corresponding to the key name, and displaying the structural data.
Converting the field of the Nth row into the structural data of the second state according to the width of the display window, and displaying the structural data, wherein the method comprises the following steps:
if the display window is converted from the first width to the second width, displaying M1 fields in the M fields of the nth row in the N +1 th row in the display window with the second width in the order from back to front, wherein the nth row in the display window with the second width displays M-M1 fields, and the second width is smaller than the first width; or,
if the display window is converted from the second width to the first width, then in the display window with the first width, the M1 fields in the fields of the (N + 1) th row are displayed in the nth row in the order from front to back, wherein the nth row in the display window with the first width displays M fields, and the second width is smaller than the first width.
Specifically, as shown in fig. 2, the first state of the JSON data may be state 1 in fig. 2, and the second state may be state 2 in fig. 2, but of course, the first state may also be state 2, and the second state may also be state 1, which is not limited herein; the following description will be given taking the first state as state 1 and the second state as state 2 as examples:
in the state 1, the display window is in a first width, and in the state 2, the display window is in a second width; a field includes a Key (Key name) and a Value (Value) corresponding to the Key name; a line of data of a display window may include a plurality of fields;
the state 1 is changed to the state 2, where N is 1, M is 3, M1 is 1, the length of the first Row (Row1) is reduced, Key3 (Key name) and Value3 (Value corresponding to the Key name) are simultaneously moved into the next Row, and the total number of rows is automatically increased.
State 2 transitions to state 1, and similarly, when N is 1, M is 3, M1 is 1, the length of the first Row (Row1) increases, Key3 (Key name) and Value3 (Value corresponding to the Key name) are simultaneously moved into the previous Row, and the total Row number automatically decreases.
Wherein, according to the fixed length of the field, the field of the Nth row is converted into the structure data of the second state, and the display is carried out, including:
converting the M fields with indefinite length in each row into the fields with fixed length, and displaying the fields in a display window; or,
the M fixed-length fields in each row are converted into non-fixed-length fields and displayed in the display window.
Specifically, as shown in fig. 3, the first state of the JSON data may be state 1 in fig. 3, and the second state may be state 2 in fig. 3, but of course, the first state may also be state 2, and the second state may also be state 1, which is not limited herein; the following description will be given taking the first state as state 1 and the second state as state 2 as examples:
the width of the display window of the state 1 is the same as that of the display window of the state 2, and one field comprises a Key (Key name) and a Value (Value) corresponding to the Key name;
the state 1 is converted into the state 2, and in each row, the length of a field formed by Key and Value is converted from an indefinite length to a fixed length.
State 2 transitions to state 1, and in each row, the length of the fields formed by Key and Value transitions from fixed length to indefinite length.
Converting the field of the Nth row into the structural data of the second state according to the hierarchy of the key name of the field, and displaying the structural data, wherein the method comprises the following steps:
expanding the key names in the Nth row into a plurality of levels of fields in a layered manner according to the levels of the key names, and displaying the expanded fields in the display window; or,
and folding the key names in the Nth row into a plurality of hierarchical fields according to the hierarchy of the key names, and displaying the folded fields in the display window.
Specifically, as shown in fig. 4, the first state of the JSON data may be state 1 in fig. 4, and the second state may be state 2 in fig. 4, but of course, the first state may also be state 2, and the second state may also be state 1, which is not limited herein; the following description will be given taking the first state as state 1 and the second state as state 2 as examples:
the width of the display window of the state 1 is the same as that of the display window of the state 2, and one field comprises a Key (Key name) and a Value (Value) corresponding to the Key name;
state 1 is converted into state 2, the child keys and Value are expanded layer by layer, the keys in each layer have the same identification, such as the same displayed color, and the keys in different layers have different identifications, such as the different displayed colors.
State 2 transitions to state 1 and the words Key and Value are collapsed (hidden) and restored to single-layer mode.
Converting the field of the Nth row into the structural data of the second state according to the hierarchy of the value corresponding to the key name of the field, and displaying the structural data, wherein the method comprises the following steps:
taking the value corresponding to the key name in the Nth row as a plurality of levels of fields, expanding the fields in a layered mode according to the level of the value corresponding to the key name, and displaying the expanded fields in the display window; or,
and taking the value corresponding to the key name in the Nth row as fields of a plurality of hierarchies, folding the fields in a layering manner according to the hierarchy of the value corresponding to the key name, and displaying the folded fields in the display window.
Specifically, as shown in fig. 5, the first state of the JSON data may be state 1 in fig. 5, and the second state may be state 2 in fig. 5, but of course, the first state may also be state 2, and the second state may also be state 1, which is not limited herein; the following description will be given taking the first state as state 1 and the second state as state 2 as examples:
the width of the display window of the state 1 is the same as that of the display window of the state 2, one field comprises a Key (Key name) and a Value (Value) corresponding to the Key name, and the Key corresponds to a plurality of values;
state 1 transitions to state 2, 1 Key4-1-1, corresponding to 4 Value4-1-1-1 through Value 4-1-1-4;
state 2 transitions to state 1 and the child Key and Value are collapsed (hidden) and restored to single-layer mode.
As shown in fig. 6, the first state of the JSON data may be state 1 in fig. 5, and the second state may be state 2 in fig. 5, but of course, the first state may also be state 2, and the second state may also be state 1, which is not limited herein; the following description will be given taking the first state as state 1 and the second state as state 2 as examples:
the width of the display window of the state 1 is the same as that of the display window of the state 2, and one field comprises a Key (Key name) and a Value (Value) corresponding to the Key name; key corresponds to a plurality of Value, wherein each Value is Keyvalue;
state 1 is converted into state 2, 1 Key4-1-1 corresponds to 2 Value4-1-1 to Value4-1-1-2, each Value can decompose Key4-1-1-1 and Value4-1-1-1-1 to Value 4-1-1-2;
state 2 transitions to state 1 and the child Key and Value are collapsed (hidden) and restored to single-layer mode.
In an optional embodiment of the present invention, the method for displaying a JSON data structure may further include:
step 13, displaying at least one function button in the display window; wherein the function buttons include at least one of:
a first button for triggering the display of the fields of each row according to a first state;
a second button for triggering the display of the fields of each row according to a second state;
the third button is used for triggering fields with key names or values corresponding to the key names in multiple levels in each row to be displayed according to a fully-folded state;
the fourth button is used for triggering fields with key names or key names corresponding to multiple levels in each row to be displayed according to a layer-by-layer folding state;
the fifth button is used for triggering fields with key names or key names corresponding to multiple levels in each row to be displayed according to a layer-by-layer expanded state;
a sixth button for triggering display of fields of a plurality of hierarchies of key names or values corresponding to the key names in each row according to a fully expanded state;
the seventh button is used for triggering the key names of the fields in each row to be displayed according to the key name translation result after the preset language translation;
the eighth button is used for triggering the value corresponding to the key name of the field in each row to be displayed according to the translated value translation result of the preset language;
a ninth button having a selected or unselected state, wherein when the ninth button is in the selected state, the unfolded and folded button group is valid for at least one selected row, and when the ninth button is in the unselected state, the unfolded and folded button group is valid for all the rows in the whole world, and the unfolded and folded button group includes at least one of the third button, the fourth button, the fifth button and the sixth button;
a tenth button, configured to screen key names of fields in each row, where a field corresponding to at least one selected key name is normally displayed, and a field of an unselected key name is not displayed;
an eleventh button, configured to screen the key name translation results of the fields in each row, where a field corresponding to at least one selected key name translation result is normally displayed, and a field corresponding to a non-selected key name translation result is not displayed;
a twelfth button for receiving an input value corresponding to the key name to be searched and normally displaying a field corresponding to the searched value;
and the thirteenth button is used for receiving the input value translation result to be searched and normally displaying the field corresponding to the searched value translation result.
As shown in fig. 7, the unfolding button may be the first button, the compact button may be the second button, the fully-folded button may be the third button, the layer-by-layer folding button may be the fourth button, the layer-by-layer unfolding button may be the fifth button, and the fully-unfolded button may be the sixth button;
as shown in fig. 8, the Key translation button may be the seventh button described above, and the Value translation button may be the eighth button described above. After a Key translation button is clicked, a result after Key translation can be displayed according to a mode in a figure;
as shown in fig. 9, after clicking the Value translation button, the result of the Value translation may be displayed in the manner shown in the figure.
As shown in fig. 10, the function of the ninth button is implemented; for example, selecting "selected" then unfolds the collapsed button group to be valid for the selected row, and if "unselected" then unfolds the collapsed button group to be globally valid. If the single-line data is very long, all the data in the page are expanded, which causes that the page is longitudinally too long and difficult to browse; and 3, limiting the expansion of the selected row to improve the experience.
As shown in fig. 11, Key screening or search, when the function of the tenth button is implemented, the default value of the screened content is "all", a Key list is displayed by clicking a xxx, and single-selection or multiple-selection can be performed, or selection can be performed after search; and selecting one or more Key items, and displaying the content of the selected Key and Value.
As shown in fig. 12, Key translation name screening or search, when the function of the eleventh button is implemented, the default Value of the screening content is "all", a xxx is clicked to display a translation name list, and single selection or multiple selection can be performed, or after search, one or more Key items are selected, and the display content is "translation name" and Value "which are hit by screening;
as shown in fig. 13, the enumeration number of Value lookup and Value screening is too large to be suitable for list selection, so that the Value lookup is directly performed; typically after Key or translation name screening, a Value lookup is performed to abbreviate the search scope. The display content is that the hit Value and the corresponding Key are screened.
As shown in fig. 14, Value translation Value search and screening, where the enumeration number of the Value and the translation Value after mixing is too large, and is not suitable for list selection, so that the Value translation Value search and screening are directly performed; typically, after Key or translation name screening, a "translation value" lookup is performed to shorten the search scope. The display content is that the hit 'translation value' and the corresponding Key are screened.
The implementations shown in fig. 2-14 described above may be used in combination in one or more ways. During specific implementation, the JSON data display method can be used in any sequence and in an unlimited number of times in an overlapping mode, so that the JSON data can be effectively and conveniently displayed.
The JSON data format in the embodiment of the invention can be used in the field of the Internet of things, and data interaction at two ends of a network can be carried out between devices communicating through the Internet of things by adopting the JSON data packet in the embodiment of the invention, so that light transmission of data is realized, and the transmission efficiency is ensured.
According to the embodiment of the invention, the JSON data structure can directly display the original structure and content of the JSON data through the conversion between the first state and the second state, so that the definition of data display is ensured.
As shown in fig. 15, an embodiment of the present invention further provides a display device 150 of a JSON data structure, including:
an obtaining module 151, configured to obtain structural data of at least one state of JSON data; the structural data includes: at least one field stored in a row, each field comprising: a key name and a value corresponding to the key name;
the processing module 152 is configured to convert the structural data in the first state in the structural data in the at least one state into the structural data in the second state, and display the structural data in the second state, where the original structure and content of the JSON data are displayed on the structural data in the second state.
Optionally, the processing module 152 is specifically configured to:
and converting the fields in each line into the structural data in the second state according to the sequence of the lines and a preset rule.
Optionally, according to the sequence of the rows, converting the fields in each row into the structural data in the second state according to a preset rule, and displaying the structural data, where the structural data includes at least one of the following:
converting the field of the Nth row into structural data of a second state according to the width of a display window, and displaying the structural data;
converting the field of the Nth row into structural data of a second state according to the fixed length of the field, and displaying the structural data;
and converting the field of the Nth row into the structural data of the second state according to the hierarchy of the key name of the field and/or the hierarchy of the value corresponding to the key name, and displaying the structural data.
Optionally, converting the field in the nth row into the structural data in the second state according to the width of the display window, and displaying the structural data, including:
if the display window is converted from the first width to the second width, displaying M1 fields in the M fields of the nth row in the N +1 th row in the display window with the second width in the order from back to front, wherein the nth row in the display window with the second width displays M-M1 fields, and the second width is smaller than the first width; or,
if the display window is converted from the second width to the first width, then in the display window with the first width, the M1 fields in the fields of the (N + 1) th row are displayed in the nth row in the order from front to back, wherein the nth row in the display window with the first width displays M fields, and the second width is smaller than the first width.
Optionally, converting the field in the nth row into the structural data in the second state according to the fixed length of the field, and displaying the structural data, including:
converting the M fields with indefinite length in each row into the fields with fixed length, and displaying the fields in a display window; or,
the M fixed-length fields in each row are converted into non-fixed-length fields and displayed in the display window.
Optionally, converting the field in the nth row into the structural data in the second state according to the hierarchy of the key name of the field, and displaying the structural data, including:
expanding the key names in the Nth row into a plurality of levels of fields in a layered manner according to the levels of the key names, and displaying the expanded fields in the display window; or,
and folding the key names in the Nth row into a plurality of hierarchical fields according to the hierarchy of the key names, and displaying the folded fields in the display window.
Optionally, converting the field in the nth row into the structural data in the second state according to the hierarchy of the value corresponding to the key name of the field, and displaying the structural data, including:
taking the value corresponding to the key name in the Nth row as a plurality of levels of fields, expanding the fields in a layered mode according to the level of the value corresponding to the key name, and displaying the expanded fields in the display window; or,
and taking the value corresponding to the key name in the Nth row as fields of a plurality of hierarchies, folding the fields in a layering manner according to the hierarchy of the value corresponding to the key name, and displaying the folded fields in the display window.
Optionally, the processing module 102 is further configured to display at least one function button in a display window; wherein the function buttons include at least one of:
a first button for triggering the display of the fields of each row according to a first state;
a second button for triggering the display of the fields of each row according to a second state;
the third button is used for triggering fields with key names or values corresponding to the key names in multiple levels in each row to be displayed according to a fully-folded state;
the fourth button is used for triggering fields with key names or key names corresponding to multiple levels in each row to be displayed according to a layer-by-layer folding state;
the fifth button is used for triggering fields with key names or key names corresponding to multiple levels in each row to be displayed according to a layer-by-layer expanded state;
a sixth button for triggering display of fields of a plurality of hierarchies of key names or values corresponding to the key names in each row according to a fully expanded state;
the seventh button is used for triggering the key names of the fields in each row to be displayed according to the key name translation result after the preset language translation;
the eighth button is used for triggering the value corresponding to the key name of the field in each row to be displayed according to the translated value translation result of the preset language;
a ninth button having a selected or unselected state, wherein when the ninth button is in the selected state, the unfolded and folded button group is valid for at least one selected row, and when the ninth button is in the unselected state, the unfolded and folded button group is valid for all the rows in the whole world, and the unfolded and folded button group includes at least one of the third button, the fourth button, the fifth button and the sixth button;
a tenth button, configured to screen key names of fields in each row, where a field corresponding to at least one selected key name is normally displayed, and a field of an unselected key name is not displayed;
an eleventh button, configured to screen the key name translation results of the fields in each row, where a field corresponding to at least one selected key name translation result is normally displayed, and a field corresponding to a non-selected key name translation result is not displayed;
a twelfth button for receiving an input value corresponding to the key name to be searched and normally displaying a field corresponding to the searched value;
and the thirteenth button is used for receiving the input value translation result to be searched and normally displaying the field corresponding to the searched value translation result.
It should be noted that the apparatus is an apparatus corresponding to the above method, and all the implementations in the above method embodiment are applicable to the embodiment of the apparatus, and the same technical effects can be achieved.
Embodiments of the present invention also provide a computer-readable storage medium comprising instructions which, when executed on a computer, cause the computer to perform the method as described above. All the implementation manners in the above method embodiment are applicable to this embodiment, and the same technical effect can be achieved.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
Furthermore, it is to be noted that in the device and method of the invention, it is obvious that the individual components or steps can be decomposed and/or recombined. These decompositions and/or recombinations are to be regarded as equivalents of the present invention. Also, the steps of performing the series of processes described above may naturally be performed chronologically in the order described, but need not necessarily be performed chronologically, and some steps may be performed in parallel or independently of each other. It will be understood by those skilled in the art that all or any of the steps or elements of the method and apparatus of the present invention may be implemented in any computing device (including processors, storage media, etc.) or network of computing devices, in hardware, firmware, software, or any combination thereof, which can be implemented by those skilled in the art using their basic programming skills after reading the description of the present invention.
Thus, the objects of the invention may also be achieved by running a program or a set of programs on any computing device. The computing device may be a general purpose device as is well known. The object of the invention is thus also achieved solely by providing a program product comprising program code for implementing the method or the apparatus. That is, such a program product also constitutes the present invention, and a storage medium storing such a program product also constitutes the present invention. It is to be understood that the storage medium may be any known storage medium or any storage medium developed in the future. It is further noted that in the apparatus and method of the present invention, it is apparent that each component or step can be decomposed and/or recombined. These decompositions and/or recombinations are to be regarded as equivalents of the present invention. Also, the steps of executing the series of processes described above may naturally be executed chronologically in the order described, but need not necessarily be executed chronologically. Some steps may be performed in parallel or independently of each other.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A method for displaying a JSON data structure, the method comprising:
acquiring structural data of at least one state of JSON data; the structural data includes: at least one field stored in a row, each field comprising: a key name and a value corresponding to the key name;
and converting the structural data of the first state in the structural data of the at least one state into structural data of a second state and displaying the structural data, wherein the structural data of the second state shows the original structure and content of the JSON data.
2. The method for displaying the JSON data structure according to claim 1, wherein converting the structural data in the first state of the structural data in the at least one state into the structural data in the second state comprises:
and converting the fields in each line into the structural data in the second state according to the sequence of the lines and a preset rule.
3. The method for displaying the JSON data structure according to claim 2, wherein the fields in each row are converted into the structural data in the second state according to a preset rule and displayed according to the sequence of the rows, and the method comprises at least one of the following steps:
converting the field of the Nth row into structural data of a second state according to the width of a display window, and displaying the structural data;
converting the field of the Nth row into structural data of a second state according to the fixed length of the field, and displaying the structural data;
and converting the field of the Nth row into the structural data of the second state according to the hierarchy of the key name of the field and/or the hierarchy of the value corresponding to the key name, and displaying the structural data.
4. The method for displaying the JSON data structure according to claim 3, wherein the step of converting the field of the Nth line into the structural data of the second state according to the width of the display window and displaying the structural data comprises the following steps:
if the display window is converted from the first width to the second width, displaying M1 fields in the M fields of the nth row in the N +1 th row in the display window with the second width in the order from back to front, wherein the nth row in the display window with the second width displays M-M1 fields, and the second width is smaller than the first width; or,
if the display window is converted from the second width to the first width, then in the display window with the first width, the M1 fields in the fields of the (N + 1) th row are displayed in the nth row in the order from front to back, wherein the nth row in the display window with the first width displays M fields, and the second width is smaller than the first width.
5. The method for displaying the JSON data structure according to claim 3, wherein the step of converting the field of the Nth row into the structural data of the second state according to the fixed length of the field and displaying the structural data comprises the following steps:
converting the M fields with indefinite length in each row into the fields with fixed length, and displaying the fields in a display window; or
The M fixed-length fields in each row are converted into non-fixed-length fields and displayed in the display window.
6. The method for displaying the JSON data structure according to claim 3, wherein the step of converting the fields in the Nth row into the structural data in the second state according to the hierarchy of the key names of the fields and displaying the structural data comprises the following steps:
expanding the key names in the Nth row into a plurality of levels of fields in a layered manner according to the levels of the key names, and displaying the expanded fields in the display window; or,
and folding the key names in the Nth row into a plurality of hierarchical fields according to the hierarchy of the key names, and displaying the folded fields in the display window.
7. The method for displaying the JSON data structure according to claim 3, wherein the step of converting and displaying the field in the nth row into the structural data in the second state according to the hierarchy of the value corresponding to the key name of the field includes:
taking the value corresponding to the key name in the Nth row as a plurality of levels of fields, expanding the fields in a layered mode according to the level of the value corresponding to the key name, and displaying the expanded fields in the display window; or,
and taking the value corresponding to the key name in the Nth row as fields of a plurality of hierarchies, folding the fields in a layering manner according to the hierarchy of the value corresponding to the key name, and displaying the folded fields in the display window.
8. The method for displaying the JSON data structure according to claim 3, 6 or 7, further comprising:
displaying at least one function button in the display window; wherein the function buttons include at least one of:
a first button for triggering the display of the fields of each row according to a first state;
a second button for triggering the display of the fields of each row according to a second state;
the third button is used for triggering fields with key names or values corresponding to the key names in multiple levels in each row to be displayed according to a fully-folded state;
the fourth button is used for triggering fields with key names or key names corresponding to multiple levels in each row to be displayed according to a layer-by-layer folding state;
the fifth button is used for triggering fields with key names or key names corresponding to multiple levels in each row to be displayed according to a layer-by-layer expanded state;
a sixth button for triggering display of fields of a plurality of hierarchies of key names or values corresponding to the key names in each row according to a fully expanded state;
the seventh button is used for triggering the key names of the fields in each row to be displayed according to the key name translation result after the preset language translation;
the eighth button is used for triggering the value corresponding to the key name of the field in each row to be displayed according to the translated value translation result of the preset language;
a ninth button having a selected or unselected state, wherein when the ninth button is in the selected state, the unfolded and folded button group is valid for at least one selected row, and when the ninth button is in the unselected state, the unfolded and folded button group is valid for all the rows in the whole world, and the unfolded and folded button group includes at least one of the third button, the fourth button, the fifth button and the sixth button;
a tenth button, configured to screen key names of fields in each row, where a field corresponding to at least one selected key name is normally displayed, and a field of an unselected key name is not displayed;
an eleventh button, configured to screen the key name translation results of the fields in each row, where a field corresponding to at least one selected key name translation result is normally displayed, and a field corresponding to a non-selected key name translation result is not displayed;
a twelfth button for receiving an input value corresponding to the key name to be searched and normally displaying a field corresponding to the searched value;
and the thirteenth button is used for receiving the input value translation result to be searched and normally displaying the field corresponding to the searched value translation result.
9. A display device of a JSON data structure, comprising:
the acquisition module is used for acquiring structural data of at least one state of JSON data; the structural data includes: at least one field stored in a row, each field comprising: a key name and a value corresponding to the key name;
and the processing module is used for converting the structural data of the first state in the structural data of the at least one state into the structural data of the second state and displaying the structural data of the second state, wherein the original structure and the content of the JSON data are displayed by the structural data of the second state.
10. A computer-readable storage medium comprising instructions which, when executed on a computer, cause the computer to perform the method of any of claims 1 to 8.
CN202010872684.XA 2020-08-26 2020-08-26 Display method and device of JSON data structure Pending CN112131839A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010872684.XA CN112131839A (en) 2020-08-26 2020-08-26 Display method and device of JSON data structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010872684.XA CN112131839A (en) 2020-08-26 2020-08-26 Display method and device of JSON data structure

Publications (1)

Publication Number Publication Date
CN112131839A true CN112131839A (en) 2020-12-25

Family

ID=73847465

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010872684.XA Pending CN112131839A (en) 2020-08-26 2020-08-26 Display method and device of JSON data structure

Country Status (1)

Country Link
CN (1) CN112131839A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103345522A (en) * 2013-07-18 2013-10-09 北京润通丰华科技有限公司 Method and device for showing and processing and showing data
CN107818088A (en) * 2016-09-05 2018-03-20 阿里巴巴集团控股有限公司 A kind of table data methods of exhibiting, device and terminal
CN109669697A (en) * 2018-12-25 2019-04-23 北京潘达互娱科技有限公司 A kind of the modularization methods of exhibiting and mobile terminal of contents list
CN110059085A (en) * 2019-03-18 2019-07-26 浙江工业大学 A kind of parsing of JSON data and modeling method of web oriented 2.0
CN111274781A (en) * 2020-01-21 2020-06-12 北京三快在线科技有限公司 Table display method and device, storage medium and electronic equipment
CN111382192A (en) * 2018-12-28 2020-07-07 北京神州泰岳软件股份有限公司 Data list display method and device and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103345522A (en) * 2013-07-18 2013-10-09 北京润通丰华科技有限公司 Method and device for showing and processing and showing data
CN107818088A (en) * 2016-09-05 2018-03-20 阿里巴巴集团控股有限公司 A kind of table data methods of exhibiting, device and terminal
CN109669697A (en) * 2018-12-25 2019-04-23 北京潘达互娱科技有限公司 A kind of the modularization methods of exhibiting and mobile terminal of contents list
CN111382192A (en) * 2018-12-28 2020-07-07 北京神州泰岳软件股份有限公司 Data list display method and device and electronic equipment
CN110059085A (en) * 2019-03-18 2019-07-26 浙江工业大学 A kind of parsing of JSON data and modeling method of web oriented 2.0
CN111274781A (en) * 2020-01-21 2020-06-12 北京三快在线科技有限公司 Table display method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
US10474317B2 (en) Dynamic node grouping in grid-based visualizations
US8522168B2 (en) System and method for navigating posts in a discussion
US8560970B2 (en) Hierarchical tag based browsing of media collections
US7432928B2 (en) User interface state reconfiguration through animation
CN107818088A (en) A kind of table data methods of exhibiting, device and terminal
Da Rocha Learn Chart. js: Create interactive visualizations for the web with chart. js 2
US9471405B1 (en) Methods and systems for access to legacy programs using non-legacy interfaces
US20030005404A1 (en) Graphical loop profile analysis
KR20080024734A (en) Apparatus and method for composing web document and apparatus for setting web document array
CN101488151A (en) System and method for gathering website contents
US9817811B2 (en) Web server system, dictionary system, dictionary call method, screen control display method, and demonstration application generation method
US8732615B2 (en) Unified interface for display and modification of data arrays
US10002117B1 (en) Translating annotation tags into suggested markup
CN103593107A (en) Interface display method and device
US8205160B2 (en) Graphical user interface for multi-frame presentation
Bouillon et al. Recovering Alternative Presentation Models of a Web Page with V AQUITA
US20080216010A1 (en) Method and system for displaying hierarchical information
CN111914528B (en) Content editing method, method for generating editor, device, equipment and medium thereof
CN112131839A (en) Display method and device of JSON data structure
US10671359B2 (en) Systems and methods for organizing, classifying, and discovering automatically generated computer software
CN115712769A (en) Method for realizing Input and pull-down and fuzzy search based on Input label
US10289388B2 (en) Process visualization toolkit
CN102193789A (en) Method and equipment for realizing configurable skip link
JP2001344230A (en) Device and method for generating multimedia document, and recording medium with program for allowing computer to execute the method recorded thereon
CN113553121A (en) Screening configuration method and system based on elementui list, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination