CN111475558B - Data conversion method and device, storage medium and electronic equipment - Google Patents

Data conversion method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN111475558B
CN111475558B CN202010265243.3A CN202010265243A CN111475558B CN 111475558 B CN111475558 B CN 111475558B CN 202010265243 A CN202010265243 A CN 202010265243A CN 111475558 B CN111475558 B CN 111475558B
Authority
CN
China
Prior art keywords
field
type
data
binary data
metadata information
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.)
Active
Application number
CN202010265243.3A
Other languages
Chinese (zh)
Other versions
CN111475558A (en
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.)
Cfets Information Technology Shanghai Co ltd
Original Assignee
Cfets Information Technology Shanghai 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 Cfets Information Technology Shanghai Co ltd filed Critical Cfets Information Technology Shanghai Co ltd
Priority to CN202010265243.3A priority Critical patent/CN111475558B/en
Publication of CN111475558A publication Critical patent/CN111475558A/en
Application granted granted Critical
Publication of CN111475558B publication Critical patent/CN111475558B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/254Extract, transform and load [ETL] procedures, e.g. ETL data flows in data warehouses
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2291User-Defined Types; Storage management thereof

Abstract

The embodiment of the invention provides a data conversion method, a device, a storage medium and electronic equipment, which are used for realizing direct conversion of data by acquiring binary data and metadata information to be converted and calling a recursive conversion function to perform data conversion by taking the binary data and the metadata information as input, thereby simplifying the data conversion process, reducing the resource consumption and improving the data conversion efficiency.

Description

Data conversion method and device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data conversion method, a data conversion device, a storage medium, and an electronic device.
Background
With the development of information technology and the wide application of distributed systems, in order to improve the efficiency of message processing and transmission between distributed system applications, compact binary message formats are generally adopted between distributed applications, but services provided by a distributed system externally are usually used in a WEB site or an APP background, and are usually REST style services based on HTTP protocol, json (Java Script Object Notation, object profile) is the most common data exchange format in REST services, so an access layer of the distributed system needs to convert Json data and binary data used in the distributed system.
At present, a common method for converting binary data into Json format data is to analyze the binary data into a binary message body object, synchronize the message body object with the Json object, and finally sequence the Json object into Json data.
The method is subjected to multiple conversions, a large number of binary message bodies and Json intermediate objects are created in the conversion process, so that a large amount of memory resources are consumed, and the conversion efficiency is low.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a data conversion method, apparatus, storage medium, and electronic device, which are used for simplifying the data conversion process, reducing the resource consumption, and improving the data conversion efficiency.
In a first aspect, an embodiment of the present invention provides a data conversion method, where the method includes:
acquiring binary data to be converted and metadata information, wherein the metadata information comprises a field name, a field type and field information;
calling a recursive conversion function to perform data conversion by taking the binary data and the metadata information as inputs;
wherein the recursive conversion function performs the steps of:
determining a target binary data field according to the input binary data;
acquiring a field type of the target binary data field in response to the presence of the target binary data field in the metadata information;
responsive to the field type being the same as the type in the metadata information and being a first type, writing a field value and a field name of the target binary data field to a function output data stream;
and in response to the field type being the same as the type in the metadata information and being of a second type, invoking the recursive conversion function with the target binary data field and the metadata information as inputs, and writing a function output data stream of the recursive conversion function into an output data stream of an upper layer recursive conversion function.
Preferably, the output data stream is Json data.
Preferably, the first type includes a numeric value, a character string, and a boolean value type.
Preferably, the second type includes a message structure type and a container type.
Preferably, the container types include List, set and Map.
Preferably, the method further comprises:
in response to the target binary data field not being present in the metadata information, no data is written to the target binary data field.
Preferably, the method further comprises:
and responsive to the field type being different from the type in the metadata information, writing no data to the target binary data field.
In a second aspect, an embodiment of the present invention proposes a data conversion device, including:
an acquisition unit configured to acquire binary data to be converted and metadata information including a field name, a field type, and field information;
a data conversion unit configured to call a recursive conversion function for data conversion with the binary data and the metadata information as inputs;
wherein the data conversion unit includes:
a determining unit configured to determine a target binary data field from the input binary data;
a first processing unit configured to acquire a field type of the target binary data field in response to the presence of the target binary data field in the metadata information;
a second processing unit configured to write a field value and a field name of the target binary data field to a function output data stream in response to the field type being the same as the type in the metadata information and being a first type;
and a third processing unit configured to call the recursive conversion function with the target binary data field and the metadata information as inputs and write a function output data stream of the recursive conversion function into an output data stream of an upper-layer recursive conversion function in response to the field type being the same as the type in the metadata information and being of a second type.
In a third aspect, an embodiment of the invention proposes a computer-readable storage medium, on which computer program instructions are stored, wherein the computer program instructions, when executed by a processor, implement the method according to the first aspect.
In a fourth aspect, an embodiment of the present invention proposes an electronic device comprising a memory and a processor, wherein the memory is configured to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in the first aspect.
According to the embodiment of the invention, the binary data and the metadata information to be converted are acquired, and the binary data and the metadata information are used as input to call the recursive conversion function to perform data conversion, so that the direct conversion of the data is realized, the data conversion process is simplified, the resource consumption is reduced, and the data conversion efficiency is improved.
Drawings
The above and other objects, features and advantages of the present invention will become more apparent from the following description of embodiments of the present invention with reference to the accompanying drawings, in which:
FIG. 1 is a schematic diagram of a data flow of a data conversion method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a data conversion method according to an embodiment of the present invention;
FIG. 3 is a flow chart of invoking a recursive conversion function for data conversion in accordance with an embodiment of the present invention;
FIG. 4 is a schematic diagram of a data conversion method according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a data conversion device according to an embodiment of the present invention;
fig. 6 is a schematic diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The present invention is described below based on examples, but the present invention is not limited to only these examples. In the following detailed description of the present invention, certain specific details are set forth in detail. The present invention will be fully understood by those skilled in the art without the details described herein. Well-known methods, procedures, flows, components and circuits have not been described in detail so as not to obscure the nature of the invention.
Moreover, those of ordinary skill in the art will appreciate that the drawings are provided herein for illustrative purposes and that the drawings are not necessarily drawn to scale.
Unless the context clearly requires otherwise, the words "comprise," "comprising," and the like throughout the application are to be construed as including but not being exclusive or exhaustive; that is, it is the meaning of "including but not limited to".
In the description of the present invention, it should be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Furthermore, in the description of the present invention, unless otherwise indicated, the meaning of "a plurality" is two or more.
Metadata (Metadata), also called intermediate data, relay data, is data describing data, mainly describing data attribute (property), and is generally structured data (such as data stored in a database, specifying the length, type, etc. of a field) for supporting functions such as indicating a storage location, history data, resource searching, file recording, etc. In the embodiment of the invention, metadata information describing binary data is utilized to perform binary data format conversion.
Fig. 1 is a schematic diagram of a data flow of a data conversion method according to an embodiment of the present invention. As shown in fig. 1, the input binary data 11 and metadata information 12 are subjected to data conversion by a converter 13, and Json data 14 is output.
Json is a lightweight data interchange format. Which stores and represents data in a text format that is completely independent of the programming language. The Json data hierarchical structure is simple and clear, is easy to read and write by people, is easy to analyze and generate by machines, and can effectively improve the network transmission efficiency.
In the embodiment of the invention, the binary data is converted into the Json data without multiple conversion, and the data conversion is directly realized by the converter, so that the data conversion process is simplified, the resource consumption is reduced, and the data conversion efficiency is improved. Of course, other formats of data than Json data may be output.
Fig. 2 is a flowchart of a data conversion method according to an embodiment of the present invention. As shown in fig. 2, the data conversion method according to the embodiment of the present invention includes the following steps:
step S210, obtaining binary data and metadata information to be converted.
Wherein the metadata information includes a field name, a field type, and field information. In particular, the field information, such as field optional, mandatory, repeat type information, binary message serializes related technical messages.
Specifically, metadata information may be obtained by parsing an IDL file of an interface, including all interface methods of a service, input and output parameters of each method, all structure information of the service interface, and all field information of each structure.
Step S220, calling a recursive conversion function to perform data conversion by taking the binary data and the metadata information as input.
Specifically, as shown in fig. 3, step S220 includes the steps of:
step S221, determining a target binary data field according to the input binary data.
Wherein the target binary field refers to any field of the binary data to be converted.
Specifically, the input binary data is parsed to obtain the target binary field.
Step S222, in response to the presence of the target binary data field in the metadata information, acquires a field type of the target binary data field.
In step S222, a search for the target binary data field is performed in the metadata information, and if so, the field type of the target binary field is acquired.
Specifically, in the embodiment of the present invention, the field type of the target binary field is obtained from the metadata information.
Step S223, in response to the field type being the same as the type in the metadata information and being the first type, writing the field value and the field name of the target binary data field into a function output data stream.
Wherein the first type includes a numeric value, a character string, and a boolean value type.
That is, if the field type of the target binary field is the same as the type in the metadata information and is any one of the first types, the field value and the field name of the target binary data field are output to the write function output data stream on the basis of step S222.
Specifically, the written character string or number may be determined according to the field type of the field metadata information. If the data type of the target binary field is a number, writing the value of the target binary field into a function output data stream according to the field type of the metadata; if the data type of the target binary field is the Boolean value, writing the Boolean value of the target binary field into the function output data stream; if the data type of the target binary field is character string, writing the character string value of the target binary field into the function output data stream.
Step S224, in response to the field type being the same as the type in the metadata information and being the second type, calls the recursive conversion function with the target binary data field and the metadata information as inputs, and writes a function output data stream of the recursive conversion function into an output data stream of an upper layer recursive conversion function.
Wherein the second type comprises a message structure type and a container type, and the container type comprises a List, a Set and a Map.
That is, if the field type of the target binary field is the same as the type in the metadata information and is any of the second types, the recursive conversion function is called with the target binary data field and the metadata information as inputs, and the function output data stream of the recursive conversion function is written into the output data stream of the upper-layer recursive conversion function, on the basis of step S222.
Specifically, a nested structure in the data is handled by calling a recursive function, and in each domain, the assignment of the domain is read, parsed and then written into the output data stream.
According to the embodiment of the invention, the binary data and the metadata information to be converted are acquired, and the binary data and the metadata information are used as input to call the recursive conversion function to perform data conversion, so that the direct conversion of the data is realized, the data conversion process is simplified, the resource consumption is reduced, and the data conversion efficiency is improved.
Fig. 4 is a schematic diagram of another data conversion method according to an embodiment of the invention. As shown in fig. 4, another data conversion method according to an embodiment of the present invention includes the following steps:
step S410 is the same as step S210 in fig. 2, step S420 is the same as step S221 in fig. 3, and the description thereof is omitted.
Step S430, judging whether the target binary data field exists in the metadata information, if so, executing step S440, otherwise executing step S450.
Step S440, obtaining a field type of the target binary data field.
Specifically, a field type of the target binary field is obtained from the metadata information.
Step S450, writing no data into the target binary data field.
That is, when the target binary data field does not exist in the metadata information, no data is written to the target binary data field.
Step S460, judging whether the field type is the same as the type in the metadata information, if so, executing step S470, otherwise, executing step S450.
That is, when the field type is different from the type in the metadata information, the parsing of the target binary data field is stopped, and the output of the function is not performed.
Step S470, determining whether the first type is the first type, if yes, executing step S480, otherwise executing step S490, and returning to execute step S420.
Wherein the first type includes a numeric value, a character string, and a boolean value type.
Step S480, writing the field value and the field name of the target binary data field into the function output data stream.
When the field type is the same as the type in the metadata information and is the first type, the field name and the field value are written into a function output.
Step S490, writing the field name of the target binary data field into the function output data stream.
Writing the field name of the second type field into the function output data stream, continuing to analyze binary data, calling a recursive conversion function to perform data conversion, and embedding the conversion result under the field name of the second type field.
Step S500, judging whether unresolved binary data exists. If so, the process returns to step S420, otherwise, the process is finished.
Specifically, if the binary data is the thread binary data, whether the unresolved binary data exists can be judged by whether the message end bit is resolved. If the binary data is Protobuf, whether the analysis is completed can be judged through the message length.
Thereby, the input binary data can be completely converted into data.
The data conversion method according to the embodiment of the present invention will be described below with a specific example.
Specifically, xml format is used as metadata description format, and Json data conversion is performed on the thread binary data.
Metadata information in xml format is as follows:
the binary data content is as follows:
i32 data tag 8
Domain number tag value 1
i32 value 1
string data type tag 11
Domain number flag value 2 2
string Length value 5 5
"2.304" 50 46 51 48 52
list data type tagging 12
Domain number tag value 3
list element number 1 1
string data type tag 11
Domain number tag value 11 11
string Length value 5 5
"token" 116 111 107 101 110
string data type tag 11
Domain number tag value 12 12
string Length value 2 2
"en" 101 110
Message structure end marker 0
Message structure end marker 0
Here, in the binary data content, the left column is binary data specific content, and the right column is ASCII code corresponding to the binary data content.
The specific conversion process is as follows:
1) As described above, the thread binary data to be converted and the metadata information in xml format are acquired.
The inlet structure is RootMessage
2) Analyzing the binary data Int32 mark and the domain number mark to obtain Int32, wherein the domain number is 1.
3) Searching the field in the metadata information, and according to the metadata information:
<Fields>
<Field name="TransactionNumber"label="optional"type="int32"number ="1"/>
it can be seen that an int32 field with a field number of 1 exists in the metadata information.
4) The field types are all int32, and are the numerical types in the first type, the field value and the field name of the field are written into the function output data stream, that is, the output data stream is updated as follows: { "TransactionNumber":1,
the field name 'TransactionNumber' is obtained from metadata information, and the field value is obtained by analyzing a binary data int32 type field.
5) And in response to the fact that the binary data is not analyzed, continuing to analyze the binary data to obtain a String type and a field with the domain number of 2.
6) Searching the field in the metadata information, and according to the metadata information:
<Field name="Price"label="optional"type="string"number="2"/>
it is known that a String type field having a field number of 2 exists in the metadata information.
7) The field types are the same as String, and are the character String types in the first type, the field value and the field name of the field are written into the function output data stream, that is, the output data stream is updated as follows: { "TransactionNumber":1, "Price": "2.304",
8) And continuing to analyze the binary data to obtain a list type and a field with the domain number of 3.
9) Searching the field in the metadata information, and according to the metadata information:
<Field name="Header"label="Repeated"type="MessageHeader"number="3"/>
it can be known that a list type field with a field number of 3 exists in the metadata information, and the field is nested in a message body message header type, and the field name is written into a function output data stream, that is, the output data stream is updated as follows:
{"TransactionNumber":1,"Price":"2.304","Header":[{
10 Continuing to analyze binary data with the MessageHeader type to obtain a field with the String type domain number of 11
11 Searching the Field in the metadata information according to < Field name= "token" label= "optional" type= "string" number= "11"/>, in the metadata information
It is known that a String type field having a field number of 11 exists in the metadata information.
12 The field type is String, and the character String type in the first type, the field value and the field name of the field are written into the function output data stream, that is, the output data stream is updated as follows:
{"TransactionNumber":1,"Price":"2.304","Header":[{"token":"token",
here, the MessageHeader type is a nested message body, and thus the output field name and field value are embedded in an upper layer, i.e., a "Header".
12 Repeating 10) 11) 12) above), the output data stream is updated as:
{"TransactionNumber":1,"Price":"2.304","Header":[{"token":"token","language":"en"
13 Continuing to analyze the binary data to obtain a message end bit, knowing that the message Header is consumed, updating the Header, and updating the output data stream as follows:
{"TransactionNumber":1,"Price":"2.304","Header":[{"token":"token","language":"en"}]
13 Continuing to analyze the binary data to obtain a message ending bit, knowing that the RootMessage of the entry message body is ended, updating the Json ending symbol, and updating the output data stream as follows:
{"TransactionNumber":1,"Price":"2.304","Header":[{"token":"token","language":"en"}]}
thus, the data conversion of binary data is completed, and the converted Json data is as follows: { "TransactionNumber":1, "Price": "2.304", "Header": [ { "token": "token", "language": "en" } ]
In the embodiment of the invention, whether each field exists in metadata is judged according to metadata information and binary data to be converted, if the field can be found in the metadata, whether the field type is the same as the type in the metadata information is further judged, if the field type is the same as the first type, such as a numerical value, a character string and a Boolean value type, the field name and the field value of the field are written into a function output data stream, if the field name and the field value are the same as the second type, such as a message structure body type and a container type, all binary data of the field and the message body metadata are converted in a recursion mode as input, and a conversion result is embedded into an upper layer output data stream, so that direct conversion of the binary data is realized, the data conversion process is simplified, the consumption of memory resources is reduced, and the data conversion efficiency is improved.
Fig. 5 is a schematic diagram of a data conversion device according to an embodiment of the invention. As shown in fig. 5, the apparatus includes an acquisition unit 51 and a data conversion unit 52, the data conversion unit 52 including a determination unit 53, a first processing unit 54, a second processing unit 55, and a third processing unit 56.
Wherein the acquisition unit 51 is configured to acquire binary data to be converted and metadata information including a field name, a field type, and field information.
The data conversion unit 52 is configured to invoke a recursive conversion function for data conversion with the binary data and the metadata information as inputs.
The determining unit 53 is configured to determine a target binary data field from binary data input as a function.
The first processing unit 54 is configured to obtain a field type of the target binary data field in response to the presence of the target binary data field in the metadata information.
The second processing unit 55 is configured to write a field value and a field name of the target binary data field to a function output data stream in response to the field type being the same as the type in the metadata information and being the first type.
The third processing unit 56 is configured to call the recursive conversion function with the target binary data field and the metadata information as inputs and to write a function output data stream of the recursive conversion function into an output data stream of an upper layer recursive conversion function in response to the field type being the same as the type in the metadata information and being of the second type.
According to the embodiment of the invention, the binary data and the metadata information to be converted are acquired, and the binary data and the metadata information are used as input to call the recursive conversion function to perform data conversion, so that the direct conversion of the data is realized, the data conversion process is simplified, the resource consumption is reduced, and the data conversion efficiency is improved.
Fig. 6 is a schematic diagram of an electronic device according to an embodiment of the invention. The electronic device shown in fig. 6 is a general-purpose data processing apparatus comprising a general-purpose computer hardware structure including at least a processor 61 and a memory 62. The processor 61 and the memory 62 are connected by a bus 63. The memory 62 is adapted to store instructions or programs executable by the processor 61. The processor 61 may be a separate microprocessor or a collection of one or more microprocessors. Thus, the processor 61 performs the process of the data and the control of other devices by executing the commands stored in the memory 62, thereby executing the method flow of the embodiment of the present invention as described above. Bus 63 connects the above-described components together, as well as to display controller 64 and display 65, and input/output (I/O) devices 66. Input/output (I/O) devices 66 may be mice, keyboards, modems, network interfaces, touch input devices, somatosensory input devices, printers, and other devices which are well known in the art. Typically, an input/output (I/O) device 66 is connected to the system through an input/output (I/O) controller 67.
The memory 62 may store software components such as an operating system, communication modules, interaction modules, and application programs, among others. Each of the modules and applications described above corresponds to a set of executable program instructions that perform one or more functions and methods described in the embodiments of the invention.
The above-described flow diagrams and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention illustrate various aspects of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
Meanwhile, as will be appreciated by those skilled in the art, aspects of embodiments of the present invention may be implemented as a system, method, or computer program product. Accordingly, aspects of embodiments of the invention may take the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a "circuit," module "or" system. Furthermore, aspects of the invention may take the form: a computer program product embodied in one or more computer-readable media having computer-readable program code embodied thereon.
Any combination of one or more computer readable media may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of embodiments of the present invention, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, such as in baseband or as part of a carrier wave. Such a propagated signal may take any of a variety of forms, including, but not limited to: electromagnetic, optical, or any suitable combination thereof. The computer readable signal medium may be any of the following: a computer-readable storage medium is not a computer-readable storage medium and can communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including: object oriented programming languages such as Java, smalltalk, C ++, PHP, python, and the like; and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package; executing partly on the user computer and partly on the remote computer; or entirely on a remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, and various modifications and variations may be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A method of data conversion, the method comprising:
acquiring binary data to be converted and metadata information, wherein the metadata information comprises a field name, a field type and field information;
calling a recursive conversion function to perform data conversion by taking the binary data and the metadata information as inputs;
wherein the recursive conversion function performs the steps of:
determining a target binary data field according to the input binary data;
acquiring a field type of the target binary data field in response to the presence of the target binary data field in the metadata information;
responsive to the field type being the same as the type in the metadata information and being a first type, writing a field value and a field name of the target binary data field to a function output data stream;
in response to the field type being the same as the type in the metadata information and being a second type, invoking the recursive conversion function with the target binary data field and the metadata information as inputs, and writing a function output data stream of the recursive conversion function into an output data stream of an upper layer recursive conversion function;
the first type comprises a numerical value, a character string and a Boolean value type;
the second type includes a message structure type and a container type.
2. The data conversion method according to claim 1, wherein the output data stream is Json data.
3. The data conversion method according to claim 1, wherein the container types include List, set, and Map.
4. The method according to claim 1, wherein the method further comprises:
in response to the target binary data field not being present in the metadata information, no data is written to the target binary data field.
5. The method according to claim 1, wherein the method further comprises:
and responsive to the field type being different from the type in the metadata information, writing no data to the target binary data field.
6. A data conversion device, the device comprising:
an acquisition unit configured to acquire binary data to be converted and metadata information including a field name, a field type, and field information;
a data conversion unit configured to call a recursive conversion function for data conversion with the binary data and the metadata information as inputs;
wherein the data conversion unit includes:
a determining unit configured to determine a target binary data field from the input binary data;
a first processing unit configured to acquire a field type of the target binary data field in response to the presence of the target binary data field in the metadata information;
a second processing unit configured to write a field value and a field name of the target binary data field to a function output data stream in response to the field type being the same as the type in the metadata information and being a first type;
a third processing unit configured to call the recursive conversion function with the target binary data field and the metadata information as inputs and write a function output data stream of the recursive conversion function into an output data stream of an upper-layer recursive conversion function in response to the field type being the same as the type in the metadata information and being a second type;
the first type comprises a numerical value, a character string and a Boolean value type;
the second type includes a message structure type and a container type.
7. A computer readable storage medium, on which computer program instructions are stored, which computer program instructions, when executed by a processor, implement the method of any of claims 1-5.
8. An electronic device comprising a memory and a processor, wherein the memory is configured to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method of any of claims 1-5.
CN202010265243.3A 2020-04-07 2020-04-07 Data conversion method and device, storage medium and electronic equipment Active CN111475558B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010265243.3A CN111475558B (en) 2020-04-07 2020-04-07 Data conversion method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010265243.3A CN111475558B (en) 2020-04-07 2020-04-07 Data conversion method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111475558A CN111475558A (en) 2020-07-31
CN111475558B true CN111475558B (en) 2024-02-23

Family

ID=71750728

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010265243.3A Active CN111475558B (en) 2020-04-07 2020-04-07 Data conversion method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111475558B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113297296B (en) * 2021-05-31 2022-08-16 西南大学 JSON processing method for multi-style type data

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109902274A (en) * 2019-02-22 2019-06-18 今天东翼科技有限公司 A kind of method and system converting json character string to thrift binary stream

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10620950B2 (en) * 2016-09-07 2020-04-14 International Business Machines Corporation Message parsing in a distributed stream processing system
US10762072B2 (en) * 2017-01-30 2020-09-01 International Business Machines Corporation Processing messages of a plurality of devices

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109902274A (en) * 2019-02-22 2019-06-18 今天东翼科技有限公司 A kind of method and system converting json character string to thrift binary stream

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
纪元 ; 李飞 ; 王玮 ; .数据转换平台的设计与实现.福建电脑.2016,(06),全文. *

Also Published As

Publication number Publication date
CN111475558A (en) 2020-07-31

Similar Documents

Publication Publication Date Title
CN112000398B (en) Method and device for determining bottom layer interface call link, computer equipment and medium
CN103443786A (en) Machine learning method to identify independent tasks for parallel layout in web browsers
CN109308254B (en) Test method, test device and test equipment
CN110515944B (en) Data storage method based on distributed database, storage medium and electronic equipment
CN110580189A (en) method and device for generating front-end page, computer equipment and storage medium
CN111045678A (en) Method, device and equipment for executing dynamic code on page and storage medium
CN113158101B (en) Visual page rendering method, device, equipment and storage medium
CN111124379B (en) Page generation method and device, electronic equipment and storage medium
CN110633079B (en) Service development method and system based on yaml language
CN113283216A (en) Webpage content display method, device, equipment and storage medium
CN110851136A (en) Data acquisition method and device, electronic equipment and storage medium
CN112395843A (en) PHP code-based service processing method, device, equipment and medium
CN111475558B (en) Data conversion method and device, storage medium and electronic equipment
JP2008134906A (en) Business process definition generation method, device and program
CN111552463A (en) Page jump method and device, computer equipment and storage medium
CN101944133A (en) XML metadata objectification analytic method and system
CN113962597A (en) Data analysis method and device, electronic equipment and storage medium
CN111783401B (en) Character string processing method and device, computer storage medium and electronic equipment
CN111311461A (en) B-S based editor and generation method for structured dynamic medical record form
CN116644213A (en) XML file reading method, device, equipment and storage medium
CN113779121A (en) Data conversion method and device, storage medium and electronic equipment
CN115965018B (en) Training method of information generation model, information generation method and device
CN115935012B (en) Service processing method of flow visual markup language based on xml
KR100958934B1 (en) Method, system and computer-readable recording medium for extracting text based on characteristic of web page
CN117724702A (en) Component configuration generation method, device, computing equipment and computer 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
GR01 Patent grant
GR01 Patent grant