CN-121979759-A - Data format conversion method, device, electronic equipment and storage medium
Abstract
The invention discloses a data format conversion method, and belongs to the technical field of data format conversion. According to the embodiment of the invention, the initial data can be converted from the initial format to the target format according to the format configuration information to obtain the target data, and each conversion process of the data can be associated to a specific configuration version through the version format configuration information, so that the full-link traceability is realized. The simulator corresponding to the initial format is called to detect the format of the target data, and the simulator corresponding to the target format is called to detect the format of the initial data to obtain a bidirectional detection result, so that the potential compatibility problem can be effectively identified by truly simulating the interaction scene between the new system and the old system, and the online accident caused by abnormality can be prevented. And generating a format conversion report according to the bidirectional detection result, wherein the format conversion report is used for representing whether the initial format is compatible with the target format or not, so that the converted data can be expected to behave on the target platform.
Inventors
- WANG CHUNYAN
- TANG JIE
- CHEN DAOYUAN
- ZHANG WEIJIAN
Assignees
- 珠海格力电器股份有限公司
- 珠海联云科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251209
Claims (10)
- 1. A method of data format conversion, the method comprising: acquiring initial data and format configuration information; According to the format configuration information, converting the initial data from an initial format to a target format to obtain target data; Invoking a simulator corresponding to the initial format to perform format detection on the target data, and invoking the simulator corresponding to the target format to perform format detection on the initial data to obtain a bidirectional detection result; and generating a format conversion report according to the bidirectional detection result, wherein the format conversion report is used for representing whether the initial format is compatible with the target format or not.
- 2. The method of claim 1, wherein the format conversion report comprises a format compatible report and a format incompatible report, and wherein generating the format conversion report based on the bi-directional detection result comprises: judging whether the field of the target data is missing, the type is not matched or encryption fails according to the bidirectional detection result; Generating a format incompatibility report under the condition that the target data field is missing, the type is not matched or encryption fails; And generating a format compatible report under the conditions that the target data field is complete, the types are matched and the encryption is successful.
- 3. The data format conversion method according to claim 1, characterized in that the method further comprises: and generating a repair suggestion according to the bidirectional detection result under the condition that the initial format is not compatible with the target format, wherein the repair suggestion is used for indicating to modify the target format so as to enable the initial format to be compatible with the target format.
- 4. The data format conversion method according to claim 1, characterized in that the method further comprises: and under the condition that the initial format is compatible with the target format, compressing the target data, and transmitting the compressed target data in a cross-platform mode.
- 5. The data format conversion method according to claim 1, characterized in that before said converting the initial data from an initial format to a target format according to the format configuration information, the method further comprises: carrying out grammar verification and semantic verification on the format configuration information; the converting the initial data from an initial format to a target format according to the format configuration information comprises: and under the condition that the grammar check and the semantic verification of the format configuration information are passed, converting the initial data from an initial format to a target format according to the format configuration information.
- 6. The data format conversion method according to claim 1, characterized in that the method further comprises: And generating a configuration snapshot corresponding to the format configuration information and a version number, wherein the configuration snapshot is used for recording the modification information of the initial data, and the version number is used for identifying the configuration snapshot corresponding to the format configuration information.
- 7. The data format conversion method according to claim 1, characterized in that the method further comprises: a difference report between the initial data and the target data is generated.
- 8. A data format conversion apparatus, the apparatus comprising: the initial data acquisition module is used for acquiring initial data and format configuration information; the target format conversion module is used for converting the initial data from the initial format to a target format according to the format configuration information so as to obtain target data; the detection result determining module is used for calling a simulator corresponding to the initial format to perform format detection on the target data and calling the simulator corresponding to the target format to perform format detection on the initial data to obtain a bidirectional detection result; And the format conversion report generation module is used for generating a format conversion report according to the bidirectional detection result, wherein the format conversion report is used for representing whether the initial format is compatible with the target format or not.
- 9. An electronic device comprising a processor, a memory and a program or instruction stored on the memory and executable on the processor, which program or instruction when executed by the processor implements the steps of the data format conversion method of claims 1-7.
- 10. A readable storage medium, characterized in that the readable storage medium has stored thereon a program or instructions which, when executed by a processor, implement the steps of the data format conversion method according to claims 1-7.
Description
Data format conversion method, device, electronic equipment and storage medium Technical Field The invention belongs to the technical field of data format conversion, and particularly relates to a data format conversion method, a data format conversion device, electronic equipment and a storage medium. Background The cross-platform data format conversion refers to a process of performing semantic preservation, structural consistency, high efficiency and reliability on the representation form of data among systems of different operating systems, programming languages, hardware architectures or communication protocols. The prior art relies primarily on static mapping configuration and protocol adaptation middleware to effect cross-platform data format conversion. Because the configuration information is stored in a static file form, the user cannot judge whether the configuration after format conversion is compatible with the old version after modification. Once the configuration is wrong, the problem of rollback or positioning is difficult to root, the cascade fault of upgrading, namely breakdown, is extremely easy to cause, and the stability and the safety of the system are seriously threatened. Disclosure of Invention The embodiment of the invention aims to provide a data format conversion method, a data format conversion device, electronic equipment and a storage medium, which can solve the problem of incompatibility of data conversion. In a first aspect, an embodiment of the present invention provides a data format conversion method, where the method includes: acquiring initial data and format configuration information; According to the format configuration information, converting the initial data from an initial format to a target format to obtain target data; Invoking a simulator corresponding to the initial format to perform format detection on the target data, and invoking the simulator corresponding to the target format to perform format detection on the initial data to obtain a bidirectional detection result; and generating a format conversion report according to the bidirectional detection result, wherein the format conversion report is used for representing whether the initial format is compatible with the target format or not. Optionally, the format conversion report comprises a format compatible report and a format incompatible report, and the generating the format conversion report according to the bidirectional detection result comprises the following steps: judging whether the field of the target data is missing, the type is not matched or encryption fails according to the bidirectional detection result; Generating a format incompatibility report under the condition that the target data field is missing, the type is not matched or encryption fails; And generating a format compatible report under the conditions that the target data field is complete, the types are matched and the encryption is successful. Optionally, the method further comprises: and generating a repair suggestion according to the bidirectional detection result under the condition that the initial format is not compatible with the target format, wherein the repair suggestion is used for indicating to modify the target format so as to enable the initial format to be compatible with the target format. Optionally, the method further comprises: and under the condition that the initial format is compatible with the target format, compressing the target data, and transmitting the compressed target data in a cross-platform mode. Optionally, before said converting the initial data from an initial format to a target format according to the format configuration information, the method further comprises: carrying out grammar verification and semantic verification on the format configuration information; the converting the initial data from an initial format to a target format according to the format configuration information comprises: and under the condition that the grammar check and the semantic verification of the format configuration information are passed, converting the initial data from an initial format to a target format according to the format configuration information. Optionally, the method further comprises: And generating a configuration snapshot corresponding to the format configuration information and a version number, wherein the configuration snapshot is used for recording the modification information of the initial data, and the version number is used for identifying the configuration snapshot corresponding to the format configuration information. Optionally, the method further comprises: a difference report between the initial data and the target data is generated. In a second aspect, an embodiment of the present invention provides a data format conversion apparatus, including: the initial data acquisition module is used for acquiring initial data and format configuration information; the target format conversion mo