CN111062189A - Data analysis method and device and electronic equipment - Google Patents
Data analysis method and device and electronic equipment Download PDFInfo
- Publication number
- CN111062189A CN111062189A CN201811204736.5A CN201811204736A CN111062189A CN 111062189 A CN111062189 A CN 111062189A CN 201811204736 A CN201811204736 A CN 201811204736A CN 111062189 A CN111062189 A CN 111062189A
- Authority
- CN
- China
- Prior art keywords
- source
- field position
- data
- target
- data format
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000007405 data analysis Methods 0.000 title claims abstract description 13
- 230000015654 memory Effects 0.000 claims description 27
- 238000004590 computer program Methods 0.000 claims description 7
- 238000006243 chemical reaction Methods 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000001360 synchronised effect Effects 0.000 description 3
- 239000012634 fragment Substances 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012806 monitoring device Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a data analysis method and device and electronic equipment, wherein the data analysis method comprises the following steps: establishing a data format corresponding table, wherein the data format corresponding table comprises a corresponding relation between a source field position of a source data format and a target field position of a target data format; reading a source data file in a source data format, and acquiring the source field position and the source field content corresponding to the source field position from the source data file; searching the data format corresponding table according to the source field position, and acquiring a target field position corresponding to the source field position; and saving the source field content in the target field position as the target field content corresponding to the target field position. The method and the device can realize the quick conversion and storage of the Json format data to the XML format data, are convenient to maintain and reduce the complexity of the program.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data analysis method and apparatus, and an electronic device.
Background
The existing method for converting the Json format data into the XML format data generally reads the Json data at the corresponding position in the Json file, determines the corresponding position in the XML file, and then stores the Json data at the corresponding position in the XML file.
Disclosure of Invention
In view of this, the present invention provides a data parsing method and apparatus, and an electronic device, which can implement fast conversion and storage from Json-format data to XML-format data.
Based on the above object, the present invention provides a data parsing method, including:
establishing a data format corresponding table, wherein the data format corresponding table comprises a corresponding relation between a source field position of a source data format and a target field position of a target data format;
reading a source data file in a source data format, and acquiring the source field position and the source field content corresponding to the source field position from the source data file;
searching the data format corresponding table according to the source field position, and acquiring a target field position corresponding to the source field position;
and saving the source field content in the target field position as the target field content corresponding to the target field position.
Optionally, the source data format is a Json format, and the target data format is an XML format.
An embodiment of the present invention further provides a data analysis apparatus, including:
the data format corresponding table comprises a corresponding relation between a source field position of a source data format and a target field position of a target data format;
the data reading module is used for reading a source data file in a source data format and acquiring the source field position and the source field content corresponding to the source field position from the source data file;
the searching module is used for searching the data format corresponding table according to the source field position and acquiring a target field position corresponding to the source field position;
and the data writing module is used for storing the source field content in the target field position as the target field content corresponding to the target field position.
Optionally, the source data format is a Json format, and the target data format is an XML format.
The embodiment of the invention also provides electronic equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the data analysis method when executing the program.
As can be seen from the above, the data analysis method and apparatus, and the electronic device provided by the present invention include establishing a data format correspondence table, reading a source data file, obtaining a source field position and a source field content corresponding to the source field position from the source data file, searching the data format correspondence table according to the source field position, obtaining a target field position corresponding to the source field position, and storing the source field content in the target field position as the target field content. The method and the device can realize the quick conversion and storage of the Json format data to the XML format data, can realize the matching and conversion of various field contents only by configuring the data format corresponding table, are convenient to maintain and reduce the complexity of a program.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flow chart of a method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to specific embodiments and the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
FIG. 1 is a schematic flow chart of a method according to an embodiment of the present invention. As shown in the figure, the data analysis method disclosed in the embodiment of the present invention includes:
s10, establishing a data format corresponding table, wherein the data format corresponding table comprises the corresponding relation between the source field position of the source data format and the target field position of the target data format;
s11: reading a source data file in a source data format, and acquiring a source field position and source field content corresponding to the source field position from the source data file;
s12: searching a data format corresponding table according to the source field position, and acquiring a target field position corresponding to the source field position;
s13: and saving the source field content corresponding to the source field position in the target field position of the target data file as the target field content corresponding to the target field position.
The process of the present invention is further illustrated below with reference to a specific example.
Taking data in a Json format as a source data format and data in an XML format as a target data format, establishing a data format corresponding table as follows:
json["color"]=xml("background","color","value");
json["document"]=xml("background","picture","document");
the data format correspondence table indicates: for the source data file in the Json format, the source field position "color" corresponds to the target field position "background-color-value" of the target data file in the XML format. For example:
the data fragments of the source data file1 in the Json format are:
the data fragments of the target data file2 in the XML format are:
reading the source data file1, obtaining a source field position "color" and a source field content "# ff 0000" corresponding to the source field position from the source data file1, searching a data format corresponding table according to the source field position "color", obtaining a target field position "background-color-value" corresponding to the source field position, and then saving the source field content "# ff 0000" corresponding to the source field position in a target field position of the target data file2 as a target field content corresponding to the target field position "background-color-value".
Fig. 2 is a schematic structural diagram of an apparatus according to an embodiment of the present invention. As shown in the drawings, the data analysis apparatus according to the embodiment of the present invention includes:
a data format correspondence table including a correspondence between a source field position of a source data format and a target field position of a target data format;
the data reading module is used for reading a source data file in a source data format and acquiring a source field position and source field content corresponding to the source field position from the source data file;
the searching module is used for searching the data format corresponding table according to the source field position and acquiring a target field position corresponding to the source field position;
and the data writing module is used for saving the source field content corresponding to the source field position in the target field position of the target data file as the target field content corresponding to the target field position.
Based on the above object, an embodiment of an apparatus for performing the data parsing method is also provided in the embodiments of the present invention. The device comprises:
one or more processors, and a memory.
The apparatus for performing the data parsing method may further include: an input device and an output device.
The processor, memory, input device, and output device may be connected by a bus or other means.
The memory, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the data parsing method in the embodiments of the present invention. The processor executes various functional applications and data processing of the server by running the nonvolatile software programs, instructions and modules stored in the memory, that is, the data analysis method of the above method embodiment is realized.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of an apparatus performing the data parsing method, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory optionally includes memory remotely located from the processor, and these remote memories may be connected to the member user behavior monitoring device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means may receive input numeric or character information and generate key signal inputs related to user settings and function control of the apparatus performing the data parsing method. The output device may include a display device such as a display screen.
The one or more modules are stored in the memory and, when executed by the one or more processors, perform the data parsing method of any of the method embodiments described above. The technical effect of the embodiment of the device for executing the data analysis method is the same as or similar to that of any method embodiment.
The embodiment of the invention also provides a non-transitory computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions can execute the processing method of the list item operation in any method embodiment. Embodiments of the non-transitory computer storage medium may be the same or similar in technical effect to any of the method embodiments described above.
Finally, it should be noted that, as will be understood by those skilled in the art, all or part of the processes in the methods of the above embodiments may be implemented by a computer program that can be stored in a computer-readable storage medium and that, when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like. The technical effect of the embodiment of the computer program is the same as or similar to that of any of the method embodiments described above.
Furthermore, the apparatuses, devices, etc. described in the present disclosure may be various electronic terminal devices, such as a mobile phone, a Personal Digital Assistant (PDA), a tablet computer (PAD), a smart television, etc., and may also be large terminal devices, such as a server, etc., and therefore the scope of protection of the present disclosure should not be limited to a specific type of apparatus, device. The client disclosed by the present disclosure may be applied to any one of the above electronic terminal devices in the form of electronic hardware, computer software, or a combination of both.
Furthermore, the method according to the present disclosure may also be implemented as a computer program executed by a CPU, which may be stored in a computer-readable storage medium. The computer program, when executed by the CPU, performs the above-described functions defined in the method of the present disclosure.
Further, the above method steps and system elements may also be implemented using a controller and a computer readable storage medium for storing a computer program for causing the controller to implement the functions of the above steps or elements.
Further, it should be appreciated that the computer-readable storage media (e.g., memory) described herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM is available in a variety of forms such as synchronous RAM (DRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
The apparatus of the foregoing embodiment is used to implement the corresponding method in the foregoing embodiment, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the idea of the invention, also features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity.
In addition, well known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown within the provided figures for simplicity of illustration and discussion, and so as not to obscure the invention. Furthermore, devices may be shown in block diagram form in order to avoid obscuring the invention, and also in view of the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the present invention is to be implemented (i.e., specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the invention, it should be apparent to one skilled in the art that the invention can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative instead of restrictive.
While the present invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic ram (dram)) may use the discussed embodiments.
The embodiments of the invention are intended to embrace all such alternatives, modifications and variances that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, substitutions, improvements and the like that may be made without departing from the spirit and principles of the invention are intended to be included within the scope of the invention.
Claims (5)
1. A data parsing method, comprising:
establishing a data format corresponding table, wherein the data format corresponding table comprises a corresponding relation between a source field position of a source data format and a target field position of a target data format;
reading a source data file in a source data format, and acquiring the source field position and the source field content corresponding to the source field position from the source data file;
searching the data format corresponding table according to the source field position, and acquiring a target field position corresponding to the source field position;
and saving the source field content in the target field position as the target field content corresponding to the target field position.
2. The data parsing method of claim 1, wherein the source data format is a Json format and the target data format is an XML format.
3. A data analysis device, comprising:
the data format corresponding table comprises a corresponding relation between a source field position of a source data format and a target field position of a target data format;
the data reading module is used for reading a source data file in a source data format and acquiring the source field position and the source field content corresponding to the source field position from the source data file;
the searching module is used for searching the data format corresponding table according to the source field position and acquiring a target field position corresponding to the source field position;
and the data writing module is used for storing the source field content in the target field position as the target field content corresponding to the target field position.
4. The data parsing apparatus of claim 3, wherein the source data format is a Json format and the target data format is an XML format.
5. 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 implements the method according to any of claims 1 to 2 when executing the program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811204736.5A CN111062189B (en) | 2018-10-16 | 2018-10-16 | Data analysis method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811204736.5A CN111062189B (en) | 2018-10-16 | 2018-10-16 | Data analysis method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111062189A true CN111062189A (en) | 2020-04-24 |
CN111062189B CN111062189B (en) | 2024-07-02 |
Family
ID=70296674
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811204736.5A Active CN111062189B (en) | 2018-10-16 | 2018-10-16 | Data analysis method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111062189B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111949716A (en) * | 2020-08-11 | 2020-11-17 | 北京锐安科技有限公司 | Formatted data output field processing method, computer device and storage medium |
CN112131291A (en) * | 2020-09-11 | 2020-12-25 | 重庆誉存大数据科技有限公司 | JSON data-based structured analysis method, device, equipment and storage medium |
CN112817926A (en) * | 2021-02-22 | 2021-05-18 | 北京安华金和科技有限公司 | File processing method and device, storage medium and electronic device |
CN113253940A (en) * | 2021-06-17 | 2021-08-13 | 北京壁仞科技开发有限公司 | Memory data dump and construction method and device, electronic equipment and storage medium |
CN114004196A (en) * | 2021-12-30 | 2022-02-01 | 云账户技术(天津)有限公司 | Method and device for converting single data format of table |
CN116594958A (en) * | 2023-05-25 | 2023-08-15 | 之江实验室 | Graph dataset loading method, system, electronic device and medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101504662A (en) * | 2009-03-13 | 2009-08-12 | 北大方正集团有限公司 | Data conversion method and apparatus |
US20140317563A1 (en) * | 2013-04-22 | 2014-10-23 | John O'Byrne | Generate field mapping |
CN105205117A (en) * | 2015-09-09 | 2015-12-30 | 郑州悉知信息科技股份有限公司 | Data table migrating method and device |
US20170132232A1 (en) * | 2014-07-17 | 2017-05-11 | Hewlett Packard Enterprise Development Lp | Data load from a data source into a target file |
US20180246886A1 (en) * | 2017-02-27 | 2018-08-30 | OSF Global Services Inc. | Data migration for platform integration |
-
2018
- 2018-10-16 CN CN201811204736.5A patent/CN111062189B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101504662A (en) * | 2009-03-13 | 2009-08-12 | 北大方正集团有限公司 | Data conversion method and apparatus |
US20140317563A1 (en) * | 2013-04-22 | 2014-10-23 | John O'Byrne | Generate field mapping |
US20170132232A1 (en) * | 2014-07-17 | 2017-05-11 | Hewlett Packard Enterprise Development Lp | Data load from a data source into a target file |
CN105205117A (en) * | 2015-09-09 | 2015-12-30 | 郑州悉知信息科技股份有限公司 | Data table migrating method and device |
US20180246886A1 (en) * | 2017-02-27 | 2018-08-30 | OSF Global Services Inc. | Data migration for platform integration |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111949716A (en) * | 2020-08-11 | 2020-11-17 | 北京锐安科技有限公司 | Formatted data output field processing method, computer device and storage medium |
CN112131291A (en) * | 2020-09-11 | 2020-12-25 | 重庆誉存大数据科技有限公司 | JSON data-based structured analysis method, device, equipment and storage medium |
CN112131291B (en) * | 2020-09-11 | 2023-12-15 | 重庆誉存大数据科技有限公司 | Structured analysis method, device and equipment based on JSON data and storage medium |
CN112817926A (en) * | 2021-02-22 | 2021-05-18 | 北京安华金和科技有限公司 | File processing method and device, storage medium and electronic device |
CN112817926B (en) * | 2021-02-22 | 2022-02-22 | 北京安华金和科技有限公司 | File processing method and device, storage medium and electronic device |
CN113253940A (en) * | 2021-06-17 | 2021-08-13 | 北京壁仞科技开发有限公司 | Memory data dump and construction method and device, electronic equipment and storage medium |
CN113253940B (en) * | 2021-06-17 | 2021-09-21 | 北京壁仞科技开发有限公司 | Memory data dump and construction method and device, electronic equipment and storage medium |
CN114004196A (en) * | 2021-12-30 | 2022-02-01 | 云账户技术(天津)有限公司 | Method and device for converting single data format of table |
CN116594958A (en) * | 2023-05-25 | 2023-08-15 | 之江实验室 | Graph dataset loading method, system, electronic device and medium |
Also Published As
Publication number | Publication date |
---|---|
CN111062189B (en) | 2024-07-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111062189B (en) | Data analysis method and device and electronic equipment | |
WO2017088509A1 (en) | Page customization method and device | |
WO2020224109A1 (en) | Real-time object recognition method and apparatus, and computer device | |
CN111385137A (en) | Terminal awakening method, server and electronic equipment | |
US11080322B2 (en) | Search methods, servers, and systems | |
RU2628253C2 (en) | Method and device for terminal marking | |
CN104378435A (en) | Method for transmitting file between browser of computing device and mobile terminal | |
CN110781139A (en) | Teaching plan resource management system and method and electronic equipment | |
CN104376090A (en) | Screen synchronization equipment of browser in computing equipment and mobile terminal | |
CN112055244A (en) | Image acquisition method and device, server and electronic equipment | |
CN104486371A (en) | Equipment and method for downloading file on batch | |
CN113873013B (en) | Offline package reorganization method and system | |
US20140324368A1 (en) | Test method, test system and electronic device employing the same | |
CN111352993A (en) | Cross-platform data synchronization method and device and electronic equipment | |
CN111104648B (en) | Software processing method and device, storage medium and electronic equipment | |
CN111382560A (en) | Courseware making method and system and electronic equipment | |
CN110806910A (en) | Method and system for optimizing carousel map and electronic equipment | |
CN111200621A (en) | Ad hoc network method and device, and electronic device | |
CN110633457A (en) | Content replacement method and device, electronic equipment and readable storage medium | |
CN108616567A (en) | A kind of picture transmission method, system, server, client and user equipment | |
CN111190529A (en) | Keyboard input method and device and electronic equipment | |
CN110765738A (en) | System and method for generating card number and electronic equipment | |
CN111158505A (en) | Thick-thin handwriting writing method and device and electronic equipment | |
CN110134843B (en) | Target file generation method and device | |
US20170124029A1 (en) | System and method of producing dynamically customized images |
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 |