CN105323627B - Set-top box JSON data parse storage method and system - Google Patents

Set-top box JSON data parse storage method and system Download PDF

Info

Publication number
CN105323627B
CN105323627B CN201510827847.1A CN201510827847A CN105323627B CN 105323627 B CN105323627 B CN 105323627B CN 201510827847 A CN201510827847 A CN 201510827847A CN 105323627 B CN105323627 B CN 105323627B
Authority
CN
China
Prior art keywords
json data
item
data
parsed
parsing
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.)
Expired - Fee Related
Application number
CN201510827847.1A
Other languages
Chinese (zh)
Other versions
CN105323627A (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.)
Shenzhen Jiuzhou Electric Appliance Co Ltd
Original Assignee
Shenzhen Jiuzhou Electric Appliance 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 Shenzhen Jiuzhou Electric Appliance Co Ltd filed Critical Shenzhen Jiuzhou Electric Appliance Co Ltd
Priority to CN201510827847.1A priority Critical patent/CN105323627B/en
Publication of CN105323627A publication Critical patent/CN105323627A/en
Application granted granted Critical
Publication of CN105323627B publication Critical patent/CN105323627B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/435Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/45Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
    • H04N21/458Scheduling content for creating a personalised stream, e.g. by combining a locally stored advertisement with an incoming stream; Updating operations, e.g. for OS modules ; time-related management operations

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention relates to a kind of set-top box JSON data parsing storage method and systems, obtain the total item of JSON data, and position record is carried out to JSON data in real time, the position of record is compared with total item, if the position of record is less than total item, it parses and is stored again by N+1 JSON data, JSON data are parsed and stored by positioning the position being abnormal, need not all JSON data be parsed and be stored, to substantially increase the efficiency of JSON data parsing storage, cost is greatly reduced.

Description

Set-top box JSON data parse storage method and system
Technical field
The present invention relates to the communications field more particularly to a kind of set-top box JSON data parsing storage methods and system.
Background technology
JSON formats are mainly used for transmitting data, use and be completely independent as a kind of data interchange format of lightweight In the text formatting of language, indicated in JavaScript object one group of data can be converted to character string, then This character string is easily transmitted between function, or passes to character string from Web client in asynchronous application Server.JavaScript is easily explained JSON, and JSON can indicate the knot more more complicated than " name/value to " Structure, these characteristics make JSON become ideal data interchange language, are easy to read and write, while being also easy to parse and generate.
In set-top box application, JSON data are often obtained from remote server.In order to avoid JSON data are anti- Multiple parsing, it will usually JSON data be parsed and store set top box side.But in set top box side parsing JSON data storage In the process, it can cause JSON data can not be after because of certain reasons (such as set top box side or server end abnormal, Network Abnormal) It is continuous to parse and store, to destroy the integrality of JSON data.In order to ensure that the integrality of JSON data, traditional method are to work as When occurring abnormal, notice parses and stores JSON data again, and this mode needs to handle it to each extremely, cost compared with Height, and need all to parse storage data again, efficiency is relatively low, is unfavorable for the parsing of JSON data significantly.
Invention content
In view of this, it is necessary to which for above-mentioned guarantee set-top box JSON data parsing storage, integrality is of high cost, efficiency is low The technical issues of, a kind of set-top box JSON data parsing storage method and system are provided.
The present invention provides a kind of set-top box JSON data parsing storage method, includes the following steps:
S10:When parsing JSON data, the data list of JSON data is obtained, JSON data are obtained by data list Total item and stored;
S20:Installation position records, for after each single item JSON data are all parsed and preserved, recording global solution The item number N of JSON data for analysing and preserving;
S30:The item number N that position records is compared with total item, if the item number N of position record is less than total item, N+1 JSON data are removed, and parses and is stored again by N+1 JSON data, until position record Item number is identical as total item.
In further mode, the step S30 further includes:
When being parsed to current JSON data, whether there is version number before detection, if there is no if explanation be the Current JSON data are then re-started parsing and stored by one parsing, and if it exists, the version number before then obtaining.
In further mode, the step S30 further includes:
The version number of current JSON data is obtained, and is compared with version number before, if inconsistent, current JSON Data are all parsed and are stored, and are updated;If consistent, the item number N that position records is compared with total item.
In further mode, the step S30 is specially:
If the item number N of position record is less than total item, when containing the path for being directed toward another JSON data in JSON data, then N+1 item datas are removed, and remove another JSON data of N+1 directions, are parsed simultaneously since N+1 item datas again Storage, while another JSON data of N+1 directions are parsed and stored again.
The present invention also provides a kind of set-top box JSON data analysis storage systems, including:
Total item acquiring unit obtains the data list of JSON data, is obtained by data list when parsing JSON data It takes the total item of JSON data and is stored;
Position recording unit, installation position record, for after each single item JSON data are all parsed and preserved, record to be The item number N of JSON data through completely parsing and preserving;
Storage unit is parsed, the item number N that position records is compared with total item, if the item number N of position record is less than Total item then removes N+1 JSON data, and parses and stored again by N+1 JSON data, until position The item number for setting record is identical as total item.
In further mode, the parsing storage unit is when parsing current JSON data, before detection With the presence or absence of version number, it is to parse for the first time if illustrating there is no if, current JSON data is re-started into parsing and are stored, If in the presence of the version number before obtaining.
In further mode, the parsing storage unit obtains the version numbers of current JSON data, and with before Version number is compared, if inconsistent, current JSON data are all parsed and stored, and are updated;It, will if consistent The item number N of position record is compared with total item.
In further mode, if the item number N of position record is less than total item, it is another to contain direction in JSON data When the path of JSON data, the parsing storage unit then removes N+1 item datas, and N+1 directions of removing is another JSON data, parse and store since N+1 item datas again, at the same parse again and store N+1 direction it is another JSON data.
Set-top box JSON data parsing storage method and system of the present invention, obtain the total item of JSON data, and right in real time JSON data carry out position record, and the position of record is compared with total item, if the position of record less than total item, by the N+1 JSON data start to parse and stored again, are solved to JSON data by positioning the position being abnormal Analysis and storage, all JSON data need not be parsed and be stored, to substantially increase the parsing storage of JSON data Efficiency greatly reduces cost.
Description of the drawings
Fig. 1 is the flow chart of the set-top box JSON data parsing storage method in one embodiment;
Fig. 2 is the structure chart of the set-top box JSON data analysis storage systems in one embodiment.
Specific implementation mode
In order to make the purpose , technical scheme and advantage of the present invention be clearer, with reference to the accompanying drawings and embodiments, right The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not For limiting the present invention.
Fig. 1 is the flow chart of the set-top box JSON data parsing storage method in one embodiment, as shown in Figure 1, the party Method includes the following steps:
S10:When parsing JSON data, the data list of JSON data is obtained, JSON data are obtained by data list Total item and stored.
In set-top box in JSON data resolvings, set-top box being caused completely can not to parse and store the different of JSON data Often there are many reasons, each exception set-top box are required for parsing storage JSON data again, this will result in cost and effect The problem of rate.To avoid this problem, in the embodiment, since when being abnormal, set-top box may have been parsed and stored Part JSON data, therefore position record can be carried out to the JSON data for having parsed storage, need not go again parsing and Store all JSON data.Specifically, for can JSON data be carried out with position record, the step is in parsing JSON data When, the data list of JSON data is obtained first, and the total item of JSON data is then obtained by data list and is stored, The total length of JSON data is obtained in this way.
S20:Installation position records, for after each single item JSON data are all parsed and preserved, recording global solution The item number N of JSON data for analysing and preserving.
After obtaining the total length of total item namely JSON data of JSON data, installation position record, position record is used After all parsing and preserving in each single item JSON data, the item number N for completely having parsed and having stored is recorded, position is recorded in often Parsing updates once after having stored a JSON data, i.e., the item number recorded is added 1, can thus be deposited in real time to having parsed The JSON data of storage are positioned.
S30:The item number N that position records is compared with total item, if the item number N of position record is less than total item, N+1 JSON data are removed, and parses and is stored again by N+1 JSON data, until position record Item number is identical as total item.
After the item number N for the JSON data that record has completely been parsed and preserved, by by recorded item number N and always Item number is compared, it will be able to know whether JSON data all parse and stored.If the item number N of position record is less than total item Number, then illustrate that JSON data are not all parsed and stored, and is abnormal when parsing and storing N+1 JSON data, N+1 JSON data are not parsed and have been stored, due to being recorded to the position being abnormal, then by N+1 Item JSON data start to parse and be stored, until the item number of position record is identical as total item, thus substantially increase The efficiency of JSON data parsing storage, greatly reduces cost.
Further, since have corresponding version in JSON data, the JSON versions of data differences of different editions, for not With the JSON data of version number, need all to carry out parsing and storing again, therefore the step further includes:To current JSON data It when being parsed, whether there is version number before detection, be to parse for the first time if illustrating there is no if, by current JSON data It re-starts parsing and stores, and if it exists, the version number before then obtaining.
Further, the version number of current JSON data is obtained, and is compared with version number before, if differing It causes, then current JSON data are all parsed and stored, and are updated;If consistent, by the item number N of position record and total item Number is compared.
Simultaneously as the value of JSON data each single item contents can be arbitrary string, which is possible to indicate to refer to To the path of another JSON data, need to parse another JSON data by the path.In this embodiment, if position record Item number N is less than total item and then removes N+1 item datas when containing the path for being directed toward another JSON data in JSON data, and Another JSON data for removing N+1 directions, parse and store since N+1 item datas again, while parsing again simultaneously Store another JSON data of N+1 directions.
Set-top box JSON data parse storage method, obtain JSON data total item, and in real time to JSON data into Line position sets record, and the position of record is compared with total item, if the position of record is less than total item, by N+1 JSON Data start to parse and stored again, and JSON data are parsed and stored by positioning the position being abnormal, Need not all JSON data be parsed and be stored, to substantially increase the efficiency of JSON data parsing storage, significantly Reduce cost.
Meanwhile the present invention also provides a kind of set-top box JSON data analysis storage systems, as shown in Fig. 2, the system includes:
Total item acquiring unit 100 obtains the data list of JSON data, is arranged by data when parsing JSON data Table obtains the total item of JSON data and is stored.
In set-top box in JSON data resolvings, set-top box being caused completely can not to parse and store the different of JSON data Often there are many reasons, each exception set-top box are required for parsing storage JSON data again, this will result in cost and effect The problem of rate.To avoid this problem, in the embodiment, since when being abnormal, set-top box may have been parsed and stored Part JSON data, therefore position record can be carried out to the JSON data for having parsed storage, need not go again parsing and Store all JSON data.Specifically, for position record, when parsing JSON data, total item can be carried out to JSON data Number acquiring unit 100 obtains the data list of JSON data first, and the total item of JSON data is then obtained by data list And stored, the total length of JSON data is obtained in this way.
Position recording unit 200, installation position record, for after each single item JSON data are all parsed and preserved, remembering Record the item number N for the JSON data for completely having parsed and having preserved.
After obtaining the total length of total item namely JSON data of JSON data, 200 installation position of position recording unit Record, position record is for after each single item JSON data are all parsed and preserved, recording the item for completely having parsed and having stored Number N, position, which is recorded in after every parsing has stored a JSON data, to be updated once, i.e., the item number recorded is added 1, thus can The JSON data for having parsed storage are positioned in real time.
Storage unit 300 is parsed, the item number N that position records is compared with total item, if the item number N of position record is small In total item, then N+1 JSON data are removed, and parse and stored again by N+1 JSON data, until The item number of position record is identical as total item.
After the item number N of JSON data that record has completely been parsed and preserved, parsing storage unit 300 is by will The item number N of record is compared with total item, it will be able to know whether JSON data all parse and stored.If position records Item number N be less than total item, then illustrate that JSON data are not all parsed and stored, parse and store N+1 JSON It is abnormal when data, N+1 JSON data are not parsed and stored, due to being carried out to the position being abnormal Record, parsing storage unit 300 are then parsed and are stored by N+1 JSON data, until the item number of position record It is identical as total item, the efficiency of JSON data parsing storage is thus substantially increased, cost is greatly reduced.
Further, since have corresponding version in JSON data, the JSON versions of data differences of different editions, for not With the JSON data of version number, needs all to carry out parsing and storing again, therefore parse storage unit 300 to current JSON numbers It when according to being parsed, whether there is version number before detection, being to parse for the first time if illustrating there is no if, by current JSON numbers According to re-starting parsing and store, and if it exists, the version number before then obtaining.
Further, parsing storage unit 300 obtains the version numbers of current JSON data, and with version number before into Row compares, if inconsistent, current JSON data are all parsed and stored, and are updated;If consistent, position is recorded Item number N be compared with total item.
Simultaneously as the value of JSON data each single item contents can be arbitrary string, which is possible to indicate to refer to To the path of another JSON data, need to parse another JSON data by the path.In this embodiment, if position record Item number N is less than total item, and when containing the path for being directed toward another JSON data in JSON data, parsing storage unit 300 is then removed N+1 item datas, and another JSON data of N+1 directions are removed, it parses and deposits since N+1 item datas again Storage, while another JSON data of N+1 directions are parsed and stored again.
Set-top box JSON data analysis storage systems, obtain JSON data total item, and in real time to JSON data into Line position sets record, and the position of record is compared with total item, if the position of record is less than total item, by N+1 JSON Data start to parse and stored again, and JSON data are parsed and stored by positioning the position being abnormal, Need not all JSON data be parsed and be stored, to substantially increase the efficiency of JSON data parsing storage, significantly Reduce cost.
Set-top box JSON data parsing storage method and system of the present invention, obtain the total item of JSON data, and right in real time JSON data carry out position record, and the position of record is compared with total item, if the position of record less than total item, by the N+1 JSON data start to parse and stored again, are solved to JSON data by positioning the position being abnormal Analysis and storage, all JSON data need not be parsed and be stored, to substantially increase the parsing storage of JSON data Efficiency greatly reduces cost.
The above is merely preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and All any modification, equivalent and improvement made by within principle etc., should all be included in the protection scope of the present invention.

Claims (8)

1. a kind of set-top box JSON data parse storage method, which is characterized in that include the following steps:
S10:When parsing JSON data, the data list of JSON data is obtained, the total of JSON data is obtained by data list Item number is simultaneously stored;
S20:Installation position records, for after each single item JSON data are all parsed and preserved, record completely to have parsed simultaneously The item number N of the JSON data of preservation, position, which is recorded in after every parsing has stored a JSON data, to be updated once;
S30:The item number N that position records is compared with total item, if the item number N of position record is less than total item, is removed N+1 JSON data, and parse and stored again by N+1 JSON data, until the item number of position record It is identical as total item.
2. set-top box JSON data according to claim 1 parse storage method, which is characterized in that the step S30 is also Including:
When being parsed to current JSON data, it whether there is version number before detection, explanation is for the first time if being not present Parsing, then re-start parsing by current JSON data and store, and if it exists, the version number before then obtaining.
3. set-top box JSON data according to claim 2 parse storage method, which is characterized in that the step S30 is also Including:
The version number of current JSON data is obtained, and is compared with version number before, if inconsistent, current JSON data It is all parsed and is stored, be updated;If consistent, the item number N that position records is compared with total item.
4. set-top box JSON data according to claim 3 parse storage method, which is characterized in that the step S30 tools Body is:
It is then removed when containing the path for being directed toward another JSON data in JSON data if the item number N of position record is less than total item N+1 item datas, and another JSON data of N+1 directions are removed, it parses and deposits since N+1 item datas again Storage, while another JSON data of N+1 directions are parsed and stored again.
5. a kind of set-top box JSON data analysis storage systems, which is characterized in that including:
Total item acquiring unit obtains the data list of JSON data, is obtained by data list when parsing JSON data The total item of JSON data is simultaneously stored;
Position recording unit, installation position record, for after each single item JSON data are all parsed and preserved, record to be complete The item number N of the whole JSON data for parsing and preserving, position, which is recorded in after every parsing has stored a JSON data, to be updated once;
Storage unit is parsed, the item number N that position records is compared with total item, if the item number N of position record is less than total item Number, then remove N+1 JSON data, and parse and stored again by N+1 JSON data, until position is remembered The item number of record is identical as total item.
6. set-top box JSON data analysis storage systems according to claim 5, which is characterized in that the parsing storage is single Member whether there is version number when being parsed to current JSON data before detection, be to solve for the first time if illustrating there is no if Analysis, then re-start parsing by current JSON data and store, and if it exists, the version number before then obtaining.
7. set-top box JSON data analysis storage systems according to claim 6, which is characterized in that the parsing storage is single Member obtains the version number of current JSON data, and is compared with version number before, if inconsistent, current JSON data are complete Portion is parsed and is stored, and is updated;If consistent, the item number N that position records is compared with total item.
8. set-top box JSON data analysis storage systems according to claim 7, which is characterized in that
If the item number N of position record is less than total item, when containing the path for being directed toward another JSON data in JSON data, the solution Analysis storage unit then removes N+1 item datas, and removes another JSON data of N+1 directions, again from N+1 item numbers According to starting to parse and store, while another JSON data of N+1 directions are parsed and stored again.
CN201510827847.1A 2015-11-24 2015-11-24 Set-top box JSON data parse storage method and system Expired - Fee Related CN105323627B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510827847.1A CN105323627B (en) 2015-11-24 2015-11-24 Set-top box JSON data parse storage method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510827847.1A CN105323627B (en) 2015-11-24 2015-11-24 Set-top box JSON data parse storage method and system

Publications (2)

Publication Number Publication Date
CN105323627A CN105323627A (en) 2016-02-10
CN105323627B true CN105323627B (en) 2018-09-04

Family

ID=55250086

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510827847.1A Expired - Fee Related CN105323627B (en) 2015-11-24 2015-11-24 Set-top box JSON data parse storage method and system

Country Status (1)

Country Link
CN (1) CN105323627B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006068261A1 (en) * 2004-12-20 2006-06-29 Matsushita Electric Industrial Co., Ltd. System and method for data transmission
CN101141197A (en) * 2007-10-18 2008-03-12 中兴通讯股份有限公司 Software download method
CN102957941A (en) * 2012-07-18 2013-03-06 深圳市同洲电子股份有限公司 Program content broadcasting method and digital television front end
CN104021043A (en) * 2014-06-23 2014-09-03 中国银行股份有限公司 Interruption reentry method and system of batch applications
CN104317960A (en) * 2014-11-14 2015-01-28 中国建设银行股份有限公司 Method and device for processing batch job

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006068261A1 (en) * 2004-12-20 2006-06-29 Matsushita Electric Industrial Co., Ltd. System and method for data transmission
CN101141197A (en) * 2007-10-18 2008-03-12 中兴通讯股份有限公司 Software download method
CN102957941A (en) * 2012-07-18 2013-03-06 深圳市同洲电子股份有限公司 Program content broadcasting method and digital television front end
CN104021043A (en) * 2014-06-23 2014-09-03 中国银行股份有限公司 Interruption reentry method and system of batch applications
CN104317960A (en) * 2014-11-14 2015-01-28 中国建设银行股份有限公司 Method and device for processing batch job

Also Published As

Publication number Publication date
CN105323627A (en) 2016-02-10

Similar Documents

Publication Publication Date Title
IL273861A (en) Event context management system
US8762332B2 (en) Systems and method for facilitating the synchronization of data on multiple user computers
JP2018510545A5 (en)
US10089338B2 (en) Method and apparatus for object storage
CN105072196B (en) The storage of distributed data packet, retrogressive method and system
US20180203829A1 (en) Automatic updated document prompt method
US20110235909A1 (en) Analyzing documents using stored templates
CN105260399A (en) Method for acquiring and retrieving distributed log
CN108076377A (en) A kind of storage of video, playback method, device, electronic equipment and storage medium
EP3745727A1 (en) Method and device for data processing
CN107704604A (en) A kind of information persistence method, server and computer-readable recording medium
CN104008124B (en) Create the method for composite file and the data storage device with composite file
CN105302789B (en) A kind of edit methods of health information shared document stencil buffers storage
CN105323627B (en) Set-top box JSON data parse storage method and system
US7958139B2 (en) Related content storage and retrieval systems and methods
CN106506641A (en) A kind of ident value extracting method of client device and device
CN108287874B (en) DB2 database management method and device
CN106658150B (en) Method and device for realizing review processing
KR101912778B1 (en) Method and device for extracting data from a data stream travelling around an ip network
US10146844B2 (en) Data retrieval apparatus, data retrieval program, and data retrieval method
US20140309984A1 (en) Generating a regular expression for entity extraction
KR20160015206A (en) Transmission device, transmission method, receiving device, and receiving method
CN110602483B (en) Video fault determination method, device and computer readable storage medium
CN105204776B (en) Data processing method and device
CN113438503B (en) Video file restoring method, device, computer equipment and 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
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180904

Termination date: 20201124