Unlock instant, AI-driven research and patent intelligence for your innovation.

Method for converting xml data into json data based on javascript

A technology of data and object data, applied in the direction of electrical digital data processing, special data processing applications, instruments, etc., can solve the problem that plug-ins cannot be directly applied, and achieve the effect of solving the problem of object data format and simple operation

Inactive Publication Date: 2016-08-17
LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF2 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Cannot be used directly in plugins

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for converting xml data into json data based on javascript

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0024] A method of converting xml data to json data based on javascript:

[0025] Parse the input xml data into xml object data,

[0026] Create a data parsing event, pass in the new object and xml object data,

[0027] According to the incoming new object and xml object data, it is judged whether the root node contains an attribute value, the attribute value is processed, and stored in the new object in the form of a child node.

[0028] Obtain the value of the root node, determine whether it is empty, store the node value in the data node, obtain the child nodes of the root node, determine the number of child nodes, and store the data in the new object according to the result.

[0029] The parsed data is returned as a json object.

[0030] Utilize above-mentioned method, the present invention will be further described in conjunction with accompanying drawing.

[0031] In the above method, to obtain the value of the root node, determine whether it is empty, store the node ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method for converting xml data into json data based on javascript and belongs to the technical field of data format conversion. According to the method, the xml object data is analyzed through a recursive call method by means of operation in the javascript, then the original data is reassigned to form the json object data which is supplied to a module requiring the data, and therefore the purpose of changing the data format is achieved. By means of the method, operation is simple, and the problems concerning the format of the object data in data analysis are solved. The method is suitable for browsers in different versions and particularly suitable for the Web field of JavaScript development.

Description

technical field [0001] The invention discloses a javascript-based method for converting XML data into JSON data, and belongs to the technical field of data format conversion. Background technique [0002] Currently, there are two main data transmission methods in page data transmission, xml and json. Compared with xml, json has smaller data volume, faster transmission speed, more convenient interaction with JavaScript, and easier analysis and processing. However, due to the late rise of json, the background data format in some old systems has been using the xml format, and when using the original background system data for new function development, if all the xml data is converted into json data at the back end, it will work The amount is large and very cumbersome. Although there are currently some methods for data structure operations, the attributes of xml nodes cannot be parsed, or the parsing is unreasonable. After parsing, it causes damage to the xml structure between...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F17/30
CPCG06F16/88
Inventor 袁绍
Owner LANGCHAO ELECTRONIC INFORMATION IND CO LTD
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More