CN114489625A - Method and device for converting JSON format text into visual configuration tool - Google Patents

Method and device for converting JSON format text into visual configuration tool Download PDF

Info

Publication number
CN114489625A
CN114489625A CN202210364081.8A CN202210364081A CN114489625A CN 114489625 A CN114489625 A CN 114489625A CN 202210364081 A CN202210364081 A CN 202210364081A CN 114489625 A CN114489625 A CN 114489625A
Authority
CN
China
Prior art keywords
configuration
json
json format
format file
file
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
CN202210364081.8A
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.)
Beijing Younuo Technology Co ltd
Original Assignee
Beijing Younuo Technology Co ltd
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 Beijing Younuo Technology Co ltd filed Critical Beijing Younuo Technology Co ltd
Priority to CN202210364081.8A priority Critical patent/CN114489625A/en
Publication of CN114489625A publication Critical patent/CN114489625A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention relates to a method and a device for converting a JSON format text into a visual configuration tool, which comprises the steps of writing a first JSON format file into a file of a preset path; rendering the first JSON format file to obtain a corresponding configuration interface; and configuring each UI element on the configuration interface to obtain the configuration interface of the visual configuration tool, monitoring the modification content of the user on the configuration interface of the visual configuration tool in real time, and converting the modified configuration interface of the visual configuration tool into a second JSON format file. The invention provides a scheme for quickly converting the configuration items into the visual configuration tools, when the configuration items are modified, software does not need to be released again, the original JSON text is directly modified, the corresponding visual configuration tools directly take effect as the modified interface, the intuition and the convenience of configuration are improved, and the development cost is also reduced.

Description

Method and device for converting JSON format text into visual configuration tool
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for converting JSON format texts into visual configuration tools.
Background
When software is developed, some parameters needing to be modified frequently are exposed outside in a text form, so that non-technical personnel can modify the parameters conveniently according to self requirements, a common exposure mode is to use a text file in a JSON format, and the technology can convert the text files in the JSON format of various different structures into visual graphical interfaces so that the modification is more convenient.
However, although the current tools can clearly display the upper and lower level structures of the JSON format, highlight the key data types of the vertical surfaces and perform basic text editor functions such as searching, canceling and the like; however, such techniques still display characters, and filling out values of the characters requires viewing additional descriptions, and also cannot hide unnecessary information, so that a user is dazzling, cannot locate a key modification point, and if new configuration items need to be expanded or removed, software needs to be reissued, thereby increasing development cost.
Disclosure of Invention
The invention aims to solve the technical problem of the prior art and provides a method and a device for converting a JSON format text into a visual configuration tool.
The technical scheme for solving the technical problems is as follows:
a method of converting JSON formatted text to a visual configuration tool, the method comprising:
reading a first JSON format file and the text content of the first JSON format file, and writing the first JSON format file into a file of a preset path;
constructing a canvas, and rendering the read first JSON format file under the file of the preset path to obtain a corresponding configuration interface, wherein the configuration interface comprises a basic element and a UI element;
configuring each UI element on the configuration interface according to the type of the configuration item of the first JSON format file and each configuration item in the first JSON format file to obtain a configuration interface of a visual configuration tool corresponding to the first JSON format file;
and monitoring the modified content of the user on the configuration interface of the visual configuration tool in real time, converting the modified configuration interface of the visual configuration tool into a second JSON format file, and storing the second JSON format file in the preset path.
Further, the reading the first JSON-format file and the text content of the first JSON-format file, and writing the first JSON-format file into a file in a preset path specifically includes:
putting the first JSON format file into a specified path, and reading the first JSON format file in the specified path when a program is started;
judging whether the first JSON format file conforms to a preset JSON format or not;
and if so, storing the data structure in the text content of the first JSON format file.
Further, the constructing the canvas renders the read first JSON format file under the file of the preset path to obtain a corresponding configuration interface, where the configuration interface includes a basic element and a UI element, and specifically includes:
rendering a basic element of the configuration interface to the first JSON format file;
rendering a corresponding number of label button components on the configuration interface according to the number of the first JSON format files, wherein the corresponding names of the first JSON format files are marked on the label buttons;
and activating the label button assembly to render the configuration interface.
Further, the configuring, according to the type of the configuration item of the first JSON-format file and each configuration item in the first JSON-format file, each UI element on the configuration interface to obtain a configuration interface of the visual configuration tool corresponding to the first JSON-format file specifically includes:
the configuration item type of the first JSON format file comprises a father node and a son configuration item;
when the type of the configuration item of the first JSON format file is a father node, providing a corresponding father node UI element for the father node, and providing a text UI element for displaying a key and a key value UI element for displaying a value for a child configuration item of the father node;
and determining the configuration auxiliary label of the sub-configuration item according to the content of the sub-configuration item.
Further, the determining a configuration auxiliary tag of the sub-configuration item according to the content of the sub-configuration item specifically includes:
when the key value of the father node is the scene service configuration, attaching a 'hide' label to a configuration item of which the key value is the type in the child configuration item of the father node;
when the key value of the parent node is the transmission mode configuration of the video plug-in, replacing the value input element of the child configuration item of the parent node with a pull-down menu UI element;
when the key value of the father node is the sub-system configuration in the scene list, generating a button component on the right side of the UI element of the father node, wherein the button component is used for generating a corresponding sub-configuration item set according to the content of the sub-configuration item under the father node when a user clicks;
when the key value of the parent node is the configuration of the display hierarchy in the button group of the pipeline button group, replacing a value input element of a child configuration item of the UI element of the parent node with a pull-down menu UI element, wherein the pull-down menu UI element is used for checking corresponding content in the pull-down menu UI by a user and storing the checked content in an array form into the value of the child configuration item;
when the key value of the father node is the icon configuration in the building roof, acquiring a corresponding map according to the value content of the child configuration item of the father node, and replacing a value input element with the map;
when the key value of the parent node is the icon color, replacing the value input element with a color bar when the value of the child configuration item of the parent node conforms to a first preset rule;
and when the value of the child configuration item of the parent node is set to true or false, replacing the value input element with a switch UI.
Further, the monitoring, in real time, the content of the modification of the user on the configuration interface of the visual configuration tool, converting the modified configuration interface of the visual configuration tool into a second JSON format file, and storing the second JSON format file in the preset path specifically includes:
monitoring the modification content of a user on a configuration interface of the visual configuration tool in real time, and recording the modification content;
comparing the modified content with the original content of the configuration interface, and replacing the original content with the modified content if the modified content is not consistent with the original content of the configuration interface;
and when it is monitored that the user clicks a save button, deserializing the configuration interface into the second JSON format file, and saving the second JSON format file to the preset path.
The method has the beneficial effects that: the method for converting the JSON format text into the visual configuration tool comprises the steps of reading a first JSON format file and the text content of the first JSON format file, and writing the first JSON format file into a file of a preset path; constructing a canvas, and rendering the read first JSON format file under the file of the preset path to obtain a corresponding configuration interface, wherein the configuration interface comprises a basic element and a UI element; and configuring each UI element on the configuration interface according to the type of the configuration item of the first JSON format file and each configuration item in the first JSON format file to obtain the configuration interface of the visual configuration tool corresponding to the first JSON format file, monitoring the modification content of a user on the configuration interface of the visual configuration tool in real time, converting the modified configuration interface of the visual configuration tool into a second JSON format file, and storing the second JSON format file in the preset path. The invention provides a scheme for quickly converting the configuration items into the visual configuration tool, and if the configuration items are to be added, modified or deleted, the original JSON text is directly modified without re-releasing software, and the corresponding visual configuration tool directly takes effect as a modified interface, so that the intuitiveness and convenience of configuration are improved, and the development cost is also reduced.
Another technical solution of the present invention for solving the above technical problems is as follows:
an apparatus for converting JSON formatted text to a visual configuration tool, the apparatus comprising:
the pre-reading module is used for reading a first JSON format file and the text content of the first JSON format file and writing the first JSON format file into a file of a preset path;
the basic construction module is used for constructing canvas, rendering the read first JSON format file under the file of the preset path and obtaining a corresponding configuration interface, wherein the configuration interface comprises basic elements and UI elements;
the generating module is used for configuring each UI element on the configuration interface according to the type of the configuration item of the first JSON format file and each configuration item in the first JSON format file to obtain a configuration interface of a visual configuration tool corresponding to the first JSON format file;
and the modification module is used for monitoring the modified content of the user on the configuration interface of the visual configuration tool in real time, converting the modified configuration interface of the visual configuration tool into a second JSON format file and storing the second JSON format file into the preset path.
Further, the pre-reading module is specifically configured to put the first JSON-format file into a specified path, and when a program is started, read the first JSON-format file in the specified path;
judging whether the first JSON format file conforms to a preset JSON format or not;
and if so, storing the data structure in the text content of the first JSON format file.
Furthermore, the present invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method for converting JSON formatted text into a visual configuration tool according to any of the above-mentioned technical solutions.
The invention further provides an electronic device, which includes a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for converting JSON-format text into a visual configuration tool according to any one of the above technical solutions when executing the program.
Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention or the description of the prior art will be briefly described below, and it is obvious that the drawings described below are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for converting a JSON-format text into a visual configuration tool according to an embodiment of the present invention;
FIG. 2 is a block diagram of an apparatus for converting JSON format text into a visual configuration tool according to another embodiment of the present invention;
fig. 3 is a schematic diagram of configuration contents and a generated configuration interface according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, shall fall within the scope of protection of the present invention.
As shown in fig. 1, a method for converting JSON-formatted text into a visual configuration tool according to an embodiment of the present invention includes the following steps:
110. reading a first JSON format file and the text content of the first JSON format file, and writing the first JSON format file into a file of a preset path.
120. And constructing a canvas, and rendering the read first JSON format file under the file of the preset path to obtain a corresponding configuration interface, wherein the configuration interface comprises a basic element and a UI element.
130. And configuring each UI element on the configuration interface according to the type of the configuration item of the first JSON format file and each configuration item in the first JSON format file to obtain the configuration interface of the visual configuration tool corresponding to the first JSON format file.
140. And monitoring the modified content of the user on the configuration interface of the visual configuration tool in real time, converting the modified configuration interface of the visual configuration tool into a second JSON format file, and storing the second JSON format file in the preset path.
Further, step 110 specifically includes:
and putting the first JSON format file into a specified path, and reading the first JSON format file in the specified path when a program is started.
And judging whether the first JSON format file conforms to a preset JSON format.
And if so, storing the data structure in the text content of the first JSON format file.
Further, step 120 specifically includes:
rendering a basic element of the configuration interface to the first JSON format file.
And rendering a corresponding number of label button components on the configuration interface according to the number of the first JSON format files, wherein the corresponding names of the first JSON format files are marked on the label buttons.
And activating the label button assembly to render the configuration interface.
Further, step 130 specifically includes:
131. the configuration item type of the first JSON format file comprises a father node and a son configuration item.
132. And when the type of the configuration item of the first JSON format file is a father node, providing a corresponding father node UI element for the father node, and providing a text UI element for displaying a key and a key value UI element for displaying a value for the child configuration item of the father node.
133. And determining the configuration auxiliary label of the sub-configuration item according to the content of the sub-configuration item.
Further, step 133 specifically includes:
and when the key value of the parent node is the scene service configuration, attaching a 'hide' label to the configuration item of which the key value is the type in the child configuration item of the parent node.
And when the key value of the parent node is the transmission mode configuration of the video plug-in, replacing the value input element of the child configuration item of the parent node with a pull-down menu UI element.
And when the key value of the parent node is the sub-system configuration in the scene list, generating a button component on the right side of the UI element of the parent node, wherein the button component is used for generating a corresponding sub-configuration item set according to the content of the sub-configuration item under the parent node when a user clicks.
And when the key value of the parent node is the configuration of the display hierarchy in the button group of the pipeline button group, replacing the value input element of the child configuration item of the UI element of the parent node with a pull-down menu UI element, wherein the pull-down menu UI element is used for checking corresponding content in the pull-down menu UI by a user and storing the checked content in the value of the child configuration item in an array form.
And when the key value of the parent node is the icon configuration in the building roof, acquiring a corresponding map according to the value content of the child configuration item of the parent node, and replacing the value input element with the map.
When the key value of the parent node is the icon color, replacing the value input element with a color bar when the value of the child configuration item of the parent node conforms to a first preset rule.
It should be understood that the first predetermined rule is to determine whether the first predetermined rule is satisfied with a "#" followed by 8 characters, or some other predetermined rule is set, which is not limited in this embodiment.
And when the value of the child configuration item of the parent node is set to true or false, replacing the value input element with a switch UI.
Further, step 140 specifically includes:
and monitoring the modification content of the user on the configuration interface of the visual configuration tool in real time, and recording the modification content.
And comparing the modified content with the original content of the configuration interface, and replacing the original content with the modified content if the modified content is not consistent with the original content of the configuration interface.
And when it is monitored that the user clicks a save button, deserializing the configuration interface into the second JSON format file, and saving the second JSON format file to the preset path.
It should be understood that, in practical applications, the technical solutions in the present application may be implemented in the following ways.
1. And establishing a file reading module for reading the system file, acquiring the specified file through the corresponding path, reading the text content in the file, providing a file rewriting function, and writing the specified text into the file of the corresponding path.
2. And constructing a graphic canvas, wherein the canvas can render 2D graphic elements and provide common UI elements such as a button component, a text input component, a text display component, a chartlet component and the like.
3. And combining the basic elements provided by the graphic canvas to generate two configuration item UI elements and a plurality of visual configuration tools.
4. And analyzing each configuration item and converting the configuration item into a corresponding configuration item UI element according to the JSON text content and the auxiliary configuration tool content.
5. And providing user interaction logic for the responded configuration items, converting the configuration items into JSON format texts after the modification through a visualization auxiliary tool, and saving the JSON format texts back to the previously read JSON format file.
The method comprises the following steps that step 1, a file reading module for reading a system file is established, the specified file can be obtained through a corresponding path and read text contents in the file, a file rewriting function is provided, and the specified text can be written into the file of the corresponding path, and the method specifically comprises the following steps:
1.1, the program specifies a relative path as the location where the configuration file is stored.
1.2, the user puts the JSON file to be displayed into a specified path.
And 1.3, starting a program to automatically read all files under the specified path.
And 1.4, judging whether the text content of the file conforms to the JSON format.
And 1.5, if the data structure is matched with the data structure, converting the data structure into a corresponding data structure and storing the data structure in a program, and if the data structure is not matched with the data structure, skipping the file.
As shown in fig. 3, step 2 is to construct a graphic canvas, which can render 2D graphic elements and provide common UI elements such as a button component, a text input component, a text display component, and a map component, and specifically includes the following steps:
2.1, after the program is started, rendering basic elements of a configuration editing interface, such as: title, decoration, etc.
And 2.2, rendering label buttons with corresponding number according to the number of the files, displaying file names on the buttons, and facilitating a user to identify a configuration interface of the corresponding files.
And 2.3, activating a first tab button by default, and rendering a configuration interface of a corresponding file.
Step 3, combining basic elements provided by the graphic canvas, generating two configuration item UI elements and a plurality of visualization configuration tools, wherein the two configuration item UI elements comprise:
the JSON format mainly comprises two configuration texts, namely 'key: { }' for displaying a father node and 'key: value' for displaying a child configuration item.
Accordingly, a UI element is provided for a parent node 'key { }', a text UI element of the key is displayed in left alignment only, and a text UI element of the key and a UI element displaying and inputting a modification value are provided for 'key: value' of the child configuration item.
For the special sub-configuration item content, configuration auxiliary tags of "hide", "dropdown", "addable", "selectable", "texture", "color", "pool" are provided.
1) "scene service configuration": hide @ type:
under the condition that the key value is 'scene service configuration' parent node, the program hides the configuration item of which the key value of the child configuration item is 'type', so that the user can not obtain or modify the content of the configuration item.
2) Video plug-in configuration/transport mode drop down UDP mode, TCP mode "
The program replaces the value input element of the sub-configuration item under the left path with a pull-down menu UI, and the user selects "@" followed by "and replaces the value content of the sub-configuration item by two separated contents through the pull-down menu.
3) Scene list configuration/subsystem/'addable { \\ associated folder \' FireControl \ '}'
The program generates a new button on the right side of the father node under the left path, and after a user clicks the new button, the corresponding child configuration item set is generated under the father node according to the configuration on the right side.
4) Pipeline button group/display hierarchy 'selectable @ park, building, floor'
And replacing the value input element of the sub-configuration item under the left path by the program in a ' pull-down menu UI ', generating a check item according to the content on the right side of the configuration ', checking the content of a response by a user through the pull-down menu, and storing the checked content into the value of the sub-configuration item by the program in an array form.
5) "architecture roof board/icon": texture @ "
And the program acquires the map resource under the specified path according to the value content of the sub-configuration item under the left path, replaces the value input element with the map, and can replace the original picture resource in the popped file selection window after the user clicks the map. The program will replace the original value content with the specified picture path string.
6) "icon color" # FFFFFF "
The program identifies the value content of the sub-configuration item, replaces the value input element with a color bar if the value is fitted with a "#" followed by 8 characters, and the user can select a color in a pop-up color picker by clicking on the color bar. The program changes the selected color to hex format instead of the original value content.
7) Whether to tile or not false
If the value content of the program identification sub configuration item is "true" or "false", the value input element is replaced by a switch UI, the user can switch the value input element by clicking the switch, and the program converts the switched state into "true" or "false" to replace the original value content.
In step 4, according to the JSON text content and the auxiliary configuration tool content, parsing each configuration item and converting into a corresponding configuration item UI element specifically includes:
and 4.1, monitoring the user interaction condition in real time by the program, and recording the modification content after the user modifies the configuration.
And 4.2, comparing whether the modified content is consistent with the original content, if so, keeping the original content, and if not, replacing the original content with the new content.
Step 5, providing user interaction logic for the responded configuration items, converting the configuration items into JSON format texts after the modification through a visual auxiliary tool, and storing the JSON format texts back into the JSON format files read previously, wherein the method specifically comprises the following steps:
and 5.1, monitoring that the user clicks a save button by the program.
And 5.2, deserializing the configuration interface into JSON text.
And 5.3, replacing the JSON text with the file content of the corresponding file name under the specified path through the file reading component.
And 5.4, finishing the modification of the configuration file.
The embodiment skillfully combines the visual configuration tool with the JSON format configuration text commonly used in the market at present, so that the non-technical personnel can adjust the internal parameters of the software through a graphical interface without additional training and learning the configuration description of the software. The technical personnel can directly modify the JSON text and select which configuration items are exposed to the outside, thereby relaxing the configuration constraint of the technical personnel and limiting the range of the non-technical personnel configuration. The JSON text is modified to act on a graphical interface in real time, software does not need to be repeatedly released, and development cost is reduced.
The method for converting the JSON format text into the visual configuration tool based on the embodiment comprises the steps of reading a first JSON format file and the text content of the first JSON format file, and writing the first JSON format file into a file with a preset path; constructing a canvas, and rendering the read first JSON format file under the file of the preset path to obtain a corresponding configuration interface, wherein the configuration interface comprises a basic element and a UI element; and configuring each UI element on the configuration interface according to the type of the configuration item of the first JSON format file and each configuration item in the first JSON format file to obtain the configuration interface of the visual configuration tool corresponding to the first JSON format file, monitoring the modification content of a user on the configuration interface of the visual configuration tool in real time, converting the modified configuration interface of the visual configuration tool into a second JSON format file, and storing the second JSON format file in the preset path. The invention provides a scheme for quickly converting the configuration items into the visual configuration tool, and if the configuration items are to be added, modified or deleted, the original JSON text is directly modified without re-releasing software, and the corresponding visual configuration tool directly takes effect as a modified interface, so that the intuitiveness and convenience of configuration are improved, and the development cost is also reduced.
As shown in fig. 2, an apparatus for converting JSON formatted text to a visual configuration tool, the apparatus comprising:
the pre-reading module is used for reading a first JSON format file and the text content of the first JSON format file and writing the first JSON format file into a file of a preset path.
And the basic construction module is used for constructing canvas, rendering the read first JSON format file under the file of the preset path, and obtaining a corresponding configuration interface, wherein the configuration interface comprises basic elements and UI elements.
And the generation module is used for configuring each UI element on the configuration interface according to the type of the configuration item of the first JSON format file and each configuration item in the first JSON format file to obtain the configuration interface of the visual configuration tool corresponding to the first JSON format file.
And the modification module is used for monitoring the modified content of the user on the configuration interface of the visual configuration tool in real time, converting the modified configuration interface of the visual configuration tool into a second JSON format file and storing the second JSON format file into the preset path.
Further, the pre-reading module is specifically configured to put the first JSON-format file into a specified path, and when a program is started, read the first JSON-format file in the specified path;
and judging whether the first JSON format file conforms to a preset JSON format.
And if so, storing the data structure in the text content of the first JSON format file.
Furthermore, the present invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method for converting JSON formatted text into a visual configuration tool according to any of the above-mentioned technical solutions.
The invention further provides an electronic device, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the program to implement the steps of the method for converting the JSON-format text into the visual configuration tool according to any one of the above technical solutions.
While the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of converting JSON formatted text to a visual configuration tool, the method comprising:
reading a first JSON format file and the text content of the first JSON format file, and writing the first JSON format file into a file of a preset path;
constructing a canvas, and rendering the read first JSON format file under the file of the preset path to obtain a corresponding configuration interface, wherein the configuration interface comprises a basic element and a UI element;
configuring each UI element on the configuration interface according to the type of the configuration item of the first JSON format file and each configuration item in the first JSON format file to obtain a configuration interface of a visual configuration tool corresponding to the first JSON format file;
and monitoring the modified content of the user on the configuration interface of the visual configuration tool in real time, converting the modified configuration interface of the visual configuration tool into a second JSON format file, and storing the second JSON format file in the preset path.
2. The method for converting JSON-formatted text into a visual configuration tool according to claim 1, wherein reading the first JSON-formatted file and the text content of the first JSON-formatted file, and writing the first JSON-formatted file into a file in a preset path specifically includes:
putting the first JSON format file into a specified path, and reading the first JSON format file in the specified path when a program is started;
judging whether the first JSON format file conforms to a preset JSON format or not;
and if so, storing the data structure in the text content of the first JSON format file.
3. The method for converting JSON-formatted text into a visual configuration tool according to claim 1, wherein the constructing of the canvas renders the read first JSON-formatted file under the file of the preset path to obtain a corresponding configuration interface, and the configuration interface includes a basic element and a UI element, and specifically includes:
rendering a basic element of the configuration interface to the first JSON format file;
rendering a corresponding number of label button components on the configuration interface according to the number of the first JSON format files, wherein the corresponding names of the first JSON format files are marked on the label buttons;
and activating the label button assembly to render the configuration interface.
4. The method for converting a JSON-formatted text into a visual configuration tool according to claim 1, wherein configuring, according to the type of the configuration item of the first JSON-formatted file and each configuration item in the first JSON-formatted file, each UI element on the configuration interface to obtain the configuration interface of the visual configuration tool corresponding to the first JSON-formatted file specifically comprises:
the configuration item type of the first JSON format file comprises a father node and a son configuration item;
when the type of the configuration item of the first JSON format file is a father node, providing a corresponding father node UI element for the father node, and providing a text UI element for displaying a key and a key value UI element for displaying a value for a child configuration item of the father node;
and determining the configuration auxiliary label of the sub-configuration item according to the content of the sub-configuration item.
5. The method for converting JSON formatted text into a visual configuration tool according to claim 4, wherein determining the configuration auxiliary tag of the sub-configuration item according to the content of the sub-configuration item specifically comprises:
when the key value of the father node is the scene service configuration, attaching a 'hide' label to a configuration item of which the key value is the type in the child configuration item of the father node;
when the key value of the parent node is the transmission mode configuration of the video plug-in, replacing the value input element of the child configuration item of the parent node with a pull-down menu UI element;
when the key value of the father node is the sub-system configuration in the scene list, generating a button component on the right side of the UI element of the father node, wherein the button component is used for generating a corresponding sub-configuration item set according to the content of the sub-configuration item under the father node when a user clicks;
when the key value of the parent node is the configuration of the display hierarchy in the button group of the pipeline button group, replacing a value input element of a child configuration item of the UI element of the parent node with a pull-down menu UI element, wherein the pull-down menu UI element is used for checking corresponding content in the pull-down menu UI by a user and storing the checked content in an array form into the value of the child configuration item;
when the key value of the father node is the icon configuration in the building top board, acquiring a corresponding map according to the value content of the child configuration item of the father node, and replacing a value input element with the map;
when the key value of the parent node is the icon color, replacing the value input element with a color bar when the value of the child configuration item of the parent node conforms to a first preset rule;
and when the value of the child configuration item of the parent node is set to true or false, replacing the value input element with a switch UI.
6. The method according to claim 1, wherein the real-time monitoring of the modified content of the user on the configuration interface of the visual configuration tool and the conversion of the modified configuration interface of the visual configuration tool into the second JSON-format file are performed, and the conversion into the preset path specifically includes:
monitoring the modification content of a user on a configuration interface of the visual configuration tool in real time, and recording the modification content;
comparing the modified content with the original content of the configuration interface, and replacing the original content with the modified content if the modified content is not consistent with the original content of the configuration interface;
and when it is monitored that the user clicks a save button, deserializing the configuration interface into the second JSON format file, and saving the second JSON format file to the preset path.
7. An apparatus for converting JSON formatted text to a visual configuration tool, the apparatus comprising:
the pre-reading module is used for reading a first JSON format file and the text content of the first JSON format file and writing the first JSON format file into a file of a preset path;
the basic construction module is used for constructing canvas, rendering the read first JSON format file under the file of the preset path, and obtaining a corresponding configuration interface, wherein the configuration interface comprises basic elements and UI elements;
the generating module is used for configuring each UI element on the configuration interface according to the type of the configuration item of the first JSON format file and each configuration item in the first JSON format file to obtain a configuration interface of a visual configuration tool corresponding to the first JSON format file;
and the modification module is used for monitoring the modified content of the user on the configuration interface of the visual configuration tool in real time, converting the modified configuration interface of the visual configuration tool into a second JSON format file and storing the second JSON format file into the preset path.
8. The apparatus for converting JSON formatted text into visual configuration tool according to claim 7,
the pre-reading module is specifically configured to put the first JSON-format file into a specified path, and when a program is started, read the first JSON-format file in the specified path;
judging whether the first JSON format file conforms to a preset JSON format or not;
and if so, storing the data structure in the text content of the first JSON format file.
9. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the steps of the method of converting JSON formatted text into a visual configuration tool of any one of claims 1 to 6.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the program, implements the steps of the method of converting JSON formatted text into a visual configuration tool according to any one of claims 1 to 6.
CN202210364081.8A 2022-04-08 2022-04-08 Method and device for converting JSON format text into visual configuration tool Pending CN114489625A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210364081.8A CN114489625A (en) 2022-04-08 2022-04-08 Method and device for converting JSON format text into visual configuration tool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210364081.8A CN114489625A (en) 2022-04-08 2022-04-08 Method and device for converting JSON format text into visual configuration tool

Publications (1)

Publication Number Publication Date
CN114489625A true CN114489625A (en) 2022-05-13

Family

ID=81487944

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210364081.8A Pending CN114489625A (en) 2022-04-08 2022-04-08 Method and device for converting JSON format text into visual configuration tool

Country Status (1)

Country Link
CN (1) CN114489625A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115378854A (en) * 2022-07-07 2022-11-22 浙江众合科技股份有限公司 Binary data message modification method based on custom JSON rule
CN117055949A (en) * 2023-10-11 2023-11-14 中博信息技术研究院有限公司 Method and system for automatically generating vite configuration

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104217029A (en) * 2014-09-26 2014-12-17 北京国双科技有限公司 Configuration file modification method and configuration file modification device
US20160314605A1 (en) * 2015-04-27 2016-10-27 Splunk Inc. Systems and methods for providing for third party visualizations
CN106775725A (en) * 2016-12-19 2017-05-31 网易(杭州)网络有限公司 A kind of visual configuration edit methods and device
CN110618983A (en) * 2019-08-15 2019-12-27 复旦大学 JSON document structure-based industrial big data multidimensional analysis and visualization method
CN113781608A (en) * 2021-01-29 2021-12-10 北京沃东天骏信息技术有限公司 Animation editing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104217029A (en) * 2014-09-26 2014-12-17 北京国双科技有限公司 Configuration file modification method and configuration file modification device
US20160314605A1 (en) * 2015-04-27 2016-10-27 Splunk Inc. Systems and methods for providing for third party visualizations
CN106775725A (en) * 2016-12-19 2017-05-31 网易(杭州)网络有限公司 A kind of visual configuration edit methods and device
CN110618983A (en) * 2019-08-15 2019-12-27 复旦大学 JSON document structure-based industrial big data multidimensional analysis and visualization method
CN113781608A (en) * 2021-01-29 2021-12-10 北京沃东天骏信息技术有限公司 Animation editing method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张新阳等: "大屏可视化技术在电力系统中的应用研究", 《电力大数据》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115378854A (en) * 2022-07-07 2022-11-22 浙江众合科技股份有限公司 Binary data message modification method based on custom JSON rule
CN115378854B (en) * 2022-07-07 2023-11-14 浙江众合科技股份有限公司 Binary data message modification method based on custom JSON rule
CN117055949A (en) * 2023-10-11 2023-11-14 中博信息技术研究院有限公司 Method and system for automatically generating vite configuration
CN117055949B (en) * 2023-10-11 2024-02-09 中博信息技术研究院有限公司 Method and system for automatically generating vite configuration

Similar Documents

Publication Publication Date Title
US11561887B2 (en) Test script debugging using an automated testing framework and UI rendering tree
CN106776514B (en) Annotating method and device
US9182981B2 (en) Systems and methods for implementing pixel-based reverse engineering of interface structure
JP4901731B2 (en) Automatic image capture for content generation
CN109471805B (en) Resource testing method and device, storage medium and electronic equipment
CN114489625A (en) Method and device for converting JSON format text into visual configuration tool
CN109739855B (en) Method and system for realizing data sheet splicing and automatically training machine learning model
CN104216691A (en) Application creating method and device
CN105229606B (en) Orientation based on content places application starting
JP2006228210A (en) Using existing content to generate active content wizard executable file for execution of task
US20150143338A1 (en) Spatial layout of hierarchical shared resources
CN101523387A (en) Data processing system, image display device and program thereof
CN112083919B (en) Target service code generation method and device based on YAML template
JP6206202B2 (en) Information processing apparatus and information processing program
CN105912315A (en) Information Processing Apparatus, Information Processing System, Information Processing Method, And A Computer Program Product
CN112364496A (en) Avionics simulation panel generation system based on HTML5 and VUE technology
JP6237135B2 (en) Information processing apparatus and information processing program
CN109358919B (en) Dynamic configuration method and device for universal page, computer equipment and storage medium
CN111813410A (en) Method and device for multi-page combined display of browser data visualization development
WO2023239468A1 (en) Cross-application componentized document generation
US7936356B2 (en) Information processing method for information registration, and information processing method for information retrieval
CN115170695A (en) Method and device for generating chart picture, electronic equipment and storage medium
CN114443022A (en) Method for generating page building block and electronic equipment
CN113821202B (en) Method, device and equipment for generating management software file and readable storage medium
US20240160410A1 (en) Application Development Platform, Micro-program Generation Method, and 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
RJ01 Rejection of invention patent application after publication

Application publication date: 20220513

RJ01 Rejection of invention patent application after publication