CN105868167B - A kind of Naming resolution method of the json formatted datas of multilayer nest - Google Patents

A kind of Naming resolution method of the json formatted datas of multilayer nest Download PDF

Info

Publication number
CN105868167B
CN105868167B CN201610140325.9A CN201610140325A CN105868167B CN 105868167 B CN105868167 B CN 105868167B CN 201610140325 A CN201610140325 A CN 201610140325A CN 105868167 B CN105868167 B CN 105868167B
Authority
CN
China
Prior art keywords
json formatted
formatted datas
datas
json
value
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
CN201610140325.9A
Other languages
Chinese (zh)
Other versions
CN105868167A (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.)
Zhejiang University of Technology ZJUT
Original Assignee
Zhejiang University of Technology ZJUT
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 Zhejiang University of Technology ZJUT filed Critical Zhejiang University of Technology ZJUT
Priority to CN201610140325.9A priority Critical patent/CN105868167B/en
Publication of CN105868167A publication Critical patent/CN105868167A/en
Application granted granted Critical
Publication of CN105868167B publication Critical patent/CN105868167B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

A kind of Naming resolution method of the json formatted datas of n-layer nesting, includes the following steps:First, data source is established based on the json formatted datas of n-layer nesting;Then, data are parsed successively from outside to inside by minimum unit of key-value pair;Finally, judge whether to meet end condition, it is the non-nested json formatted datas that parsing obtains to meet the string that end condition then generates.The present invention provides one kind on the basis of ensureing data exchange and parsing accuracy, improves the Naming resolution method of the data exchange json formatted data nested with the n-layer of analyzing efficiency.

Description

A kind of Naming resolution method of the json formatted datas of multilayer nest
Technical field
The present invention relates to the application fields such as a kind of communication network information, the network planning and communication protocol, more particularly to A kind of Naming resolution method of the json formatted datas of multilayer nest.
Background technology
With information-based industrialized fast ripe development, the level of IT application of enterprise is continuously improved, information exchange it is not smooth Also become a significant bottleneck of informatization therewith.Important composition portion of the data exchange as the various applications of computer network Point, be increasingly becoming solves the problems, such as " information island " phenomenon main means, and current informationization construction must face. With the rapid development of Web technologies, the application based on B/S frameworks is more and more abundant, and client and server end data is exchanged, counted It is also more and more according to the mode of parsing.In traditional engineer application, data exchange and data solution between client and server The traditional approach of analysis, less efficient, serious system effect and user's body of the influence based on B/S architecture systems for exchanging and parsing It testing, people are making every effort to find a kind of data interchange format that data transfer overhead is small, to improve the efficiency of data transmission, so that Application program is efficiently executed, and the usage experience of user is more preferable.
It is to be based on that json (JavaScript Object Notation), which is a kind of data interchange format of lightweight, The a subset of ECMAScript.Json using being totally independent of the text formatting of language, but also using include C, C++, C#, Java, JavaScript, Perl, Python etc. are similar to the custom of C language family.These characteristics make json become ideal number According to exchange language.It is easy to people to read and write, while is also easy to machine parsing and generating, greatly promotes network transmission speed. The data format of json formatted datas is fairly simple, is easy to read and write, and for format through overcompression, occupied bandwidth is smaller, supports simultaneously Multilingual parses convenient for server end.For most of Web applications, complicated XML is not needed at all to transmit number According to json data interchange formats provide better simplicity and flexibility.
XML extending mark languages for flag data, define data type, be a kind of permission user to the label language of oneself Say the original language being defined.The maximum advantages of XML are that the management to various data, any system can be solved by XML Parser reads XML data, therefore its data P Passable is everywhere, and the problem of do not supported without worry system.Due to XML With fine professional platform independence and versatility, data exchange and sharing gradually is completed as intermediate medium, isomeric data will be used for Library data exchange, the shortcomings that preferably overcoming conventional data exchange mode.However, XML file is huger, file format compares Complexity, occupied bandwidth is bigger when transmission, and server end and client are required for that a large amount of codes is spent to parse XML, cause to take Business device end and client code become complex and not easy care, and client and server parsing XML will spend more money Source and time.In particular, the mode for parsing XML between different browsers is inconsistent, needs to repeat to write many codes, develop Inefficiency.
Therefore, current data analytic technique needs us to improve there is many defects.
Invention content
In order to overcome the shortcomings of the data exchange of existing Naming resolution method and parse less efficient, present invention offer one kind The json formats of the multilayer nest of data exchange and analyzing efficiency are improved on the basis of ensureing data exchange and parsing accuracy The Naming resolution method of data.
The technical solution adopted by the present invention to solve the technical problems is:
A kind of Naming resolution method of the json formatted datas of multilayer nest, the Naming resolution method includes following step Suddenly:
1) parameter initialization:Set the json formatted datas of one group of multilayer nest WhereinIndicate the key assignments of json formatted datas,Table Show json formatted data key assignmentsCorresponding value, n indicate that the number of plies of json formatted data nestings, m indicate that n-th layer is corresponding The group number of json formatted datas, k, p, q, l, λ be used for identify distinguish json formatted datas key and be worth and k, p, q, l, λ ∈ N+ | 0 < k < p < q < l < λ };
2) it parses and names json formatted datas, process as follows:
2.1) judge whether str is json formatted datas, if str is json formatted datas, is entered step 2.2), it is no Then it is transferred to step 2.6);
2.2) n=1, m=1, k=1 are set, takes one group of key-value pair of json formatted datas, key assignments to be Value is
2.3) judge whether k < λ are true, if condition is set up, enter step 2.4), be otherwise transferred to step 2.8);
2.4) judge whether value is json formatted datas, if condition is set up, enter step 2.5), be otherwise transferred to step It is rapid 2.6);
2.5) withAs new json formatted datas, key assignments isValue isIt willWithIt is spliced to formIt is transferred to step 2.3);
2.6) key assignments and value are written in new json formatted datas string, are entered step 2.7);
2.7) m=m+1, k=k+1, take the json formatted datas, key assignments to beValue isIt is transferred to step 2.3), wherein string is the json formatted datas of the new non-nesting generated;
2.8) parsing terminates, and generates the result that the json formatted datas string of new non-nesting is.
The present invention technical concept be:First, data source is established based on the json formatted datas of n-layer nesting;Then, Data are parsed successively from outside to inside by minimum unit of key-value pair;Finally, judge whether to meet end condition, meet end condition The string then generated is the non-nested json formatted datas that parsing obtains.
Beneficial effects of the present invention are:Ensure data exchange and parsing accuracy on the basis of, improve data exchange and Analyzing efficiency.
Description of the drawings
Fig. 1 is a kind of Naming resolution method schematic diagram of the json formatted datas of n-layer nesting.
Specific implementation mode
The invention will be further described below in conjunction with the accompanying drawings.
Referring to Fig.1, the Naming resolution method of the json formatted datas of a kind of multilayer nest, includes the following steps:
1) parameter initialization:Set the json formatted datas of one group of multilayer nest WhereinIndicate the key assignments of json formatted datas,It indicates Json formatted data key assignmentsCorresponding value, n indicate that the number of plies of json formatted data nestings, m indicate that n-th layer is corresponding The group number of json formatted datas, k, p, q, l, λ be used for identify distinguish json formatted datas key and be worth and k, p, q, l, λ ∈ N+ | 0 < k < p < q < l < λ };
2) it parses and names json formatted datas, process as follows:
2.1) judge whether str is json formatted datas, if str is json formatted datas, is entered step 2.2), it is no It is then transferred to step 2.6), as judged whether str is json formatted datas in Fig. 1;
2.2) n=1, m=1, k=1 are set, takes one group of key-value pair of json formatted datas, key assignments to be Value is
2.3) judge whether k < λ are true, if condition is set up, enter step 2.4), be otherwise transferred to step 2.8) such as Fig. 1 Whether middle Rule of judgment A is true;
2.4) judge whether value is json formatted datas, if condition is set up, enter step 2.5), be otherwise transferred to step It is rapid 2.6), as whether Rule of judgment B true in Fig. 1;
2.5) withAs new json formatted datas, key assignments isValue isIt willWithIt is spliced to formIt is transferred to step 2.3);As n and k adds respectively in Fig. 1 1, it is spliced to form key assignments;
2.6) key assignments and value are written in new json formatted datas string, are entered step 2.7), as being written in Fig. 1 New json formatted datas string;
2.7) m=m+1, k=k+1, take the json formatted datas, key assignments to beValue isIt is transferred to step 2.3), wherein string is the json formatted datas of the new non-nesting generated, such as Fig. 1 Middle m and k adds 1 respectively, is spliced to form new key assignments;
2.8) parsing terminates, and generates the result that the json formatted datas string of new non-nesting is.
The present embodiment is with character string For embodiment, a kind of Naming resolution method of the json formatted datas of multilayer nest, wherein comprising with Lower step:
1) parameter initialization:Set the json formatted datas of one group of n-layer nesting WhereinIt indicates The key assignments of json formatted datas, " hanghzou ", " shanghai ", " beijing " indicate json formatted data key assignmentsCorresponding value;
2) parse and name json formatted datas:
2.1) judge whether str is json formatted datas, if str is json formatted datas, is entered step 2.2), it is no Then it is transferred to step 2.6);
2.2) n=1, m=1, k=1 are set, takes one group of key-value pair of json formatted datas, key assignments to be Value is
2.3) judge whether k < λ are true, if condition is set up, enter step 2.4), be otherwise transferred to step 2.8);2.4) Judge whether value is json formatted datas, if condition is set up, enters step 2.5), be otherwise transferred to step 2.6);
2.5) withAs new json formatted datas, key assignments isValue isIt willWithIt is spliced to formIt is transferred to step 2.3);
2.6) key assignments and value are written in new json formatted datas string, are entered step 2.7);
2.7) m=m+1, k=k+1, take the json formatted datas, key assignments to beValue is It is transferred to step 2.3), wherein string is the json formatted datas of the new non-nesting generated;
2.8) parsing terminates, and generates the json formatted datas of new non-nesting For obtained result.
Described above is the excellent results that one embodiment that the present invention provides is shown, it is clear that the present invention is not only suitable for Above-described embodiment, can be right under the premise of without departing from essence spirit of the present invention and without departing from content involved by substantive content of the present invention It does many variations and is implemented.

Claims (1)

1. a kind of Naming resolution method of the json formatted datas of multilayer nest, it is characterised in that:The Naming resolution method packet Include following steps:
1) parameter initialization:Set the json formatted datas of one group of multilayer nest Wherein,Indicate the key assignments of json formatted datas,Table Show json formatted data key assignmentsCorresponding value, n indicate that the number of plies of json formatted data nestings, m indicate that n-th layer is corresponding The group number of json formatted datas, k, p, q, l, λ be used for identify distinguish json formatted datas key and be worth and k, p, q, l, λ ∈ N+ | 0 < k < p < q < l < λ };
2) it parses and names json formatted datas, process as follows:
2.1) judge whether str is json formatted datas, if str is json formatted datas, enters step 2.2), otherwise turns Enter step 2.6);
2.2) n=1, m=1, k=1 are set, takes one group of key-value pair of json formatted datas, key assignments to beValue is
2.3) judge whether k < λ are true, if condition is set up, enter step 2.4), be otherwise transferred to step 2.8);
2.4) judge whether value is json formatted datas, if condition is set up, enter step 2.5), be otherwise transferred to step 2.6);
2.5) withAs new json formatted datas, key assignments isValue isIt willWithIt is spliced to formIt is transferred to step 2.3);
2.6) key assignments and value are written in new json formatted datas string, are entered step 2.7);
2.7) m=m+1, k=k+1, take the json formatted datas, key assignments to beValue isIt is transferred to step 2.3), wherein string is the json formatted datas of the new non-nesting generated;
2.8) parsing terminates, and generates the result that the json formatted datas string of new non-nesting is.
CN201610140325.9A 2016-03-11 2016-03-11 A kind of Naming resolution method of the json formatted datas of multilayer nest Active CN105868167B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610140325.9A CN105868167B (en) 2016-03-11 2016-03-11 A kind of Naming resolution method of the json formatted datas of multilayer nest

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610140325.9A CN105868167B (en) 2016-03-11 2016-03-11 A kind of Naming resolution method of the json formatted datas of multilayer nest

Publications (2)

Publication Number Publication Date
CN105868167A CN105868167A (en) 2016-08-17
CN105868167B true CN105868167B (en) 2018-09-07

Family

ID=56625598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610140325.9A Active CN105868167B (en) 2016-03-11 2016-03-11 A kind of Naming resolution method of the json formatted datas of multilayer nest

Country Status (1)

Country Link
CN (1) CN105868167B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032500B (en) * 2019-03-01 2023-06-09 创新先进技术有限公司 Multi-layer nested data analysis method and device
CN112836475A (en) * 2020-11-24 2021-05-25 辽宁振兴银行股份有限公司 Method for converting mixed JSON and XML data into two-dimensional array

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105069116A (en) * 2015-08-11 2015-11-18 北京思特奇信息技术股份有限公司 Method and system for converting json string into array

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7530015B2 (en) * 2003-06-25 2009-05-05 Microsoft Corporation XSD inference

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105069116A (en) * 2015-08-11 2015-11-18 北京思特奇信息技术股份有限公司 Method and system for converting json string into array

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Discovering JavaScript Object Notation;Charles Severance;《Computer》;20120405;第45卷(第4期);6-8 *
XML与JSON在WEB中对数据封装解析的对比;雷映喜 等;《价值工程》;20130328(第9期);210-211 *

Also Published As

Publication number Publication date
CN105868167A (en) 2016-08-17

Similar Documents

Publication Publication Date Title
CN110784419B (en) Method and system for visualizing professional railway electric service data
Wang Improving data transmission in web applications via the translation between XML and JSON
Lin et al. Comparison between JSON and XML in Applications Based on AJAX
Brown et al. Implementation patterns for microservices architectures
CN107463409A (en) A kind of interface conversion method, interface convertor, storage medium and electric terminal
CN102831190B (en) A kind of method that CML files are browsed in low side devices
CN108337236A (en) A kind of gRPC call methods and device based on Protobuf and HTTP/1.1
CN108334411A (en) Resource transfer method and device based on Redfish in a kind of BMC
CN103077185A (en) Object-based user-defined information-expanding method
TWI592807B (en) Method and device for web style address merge
CN107783967A (en) Technology for the document translation of automation
CN101930455A (en) Structured data exchanging method
US20180260389A1 (en) Electronic document segmentation and relation discovery between elements for natural language processing
CN105808262B (en) A kind of name matching process based on json formatted datas
CN103631783B (en) A kind of generation method and system of front end page
CN102567310B (en) Networking artificial intelligence's translation system based on Intelligence repository and interpretation method thereof
CN105868167B (en) A kind of Naming resolution method of the json formatted datas of multilayer nest
CN104750866B (en) Method and system based on flush type WEB server dynamic generation menu bar
CN109933331A (en) Data transfer device and associated component between a kind of client-server
JP2008134906A (en) Business process definition generation method, device and program
CN105589918B (en) A kind of method and device for extracting page info
Gu et al. Comparative analysis of WebForms MVC and MVP architecture
CN106776285A (en) Webpage front-end adjustment method and device
US9886424B2 (en) Web application framework for extracting content
CN115392193A (en) Message conversion code generation method, related device and computer storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant