Supercharge Your Innovation With Domain-Expert AI Agents!

Method and device for automatically identifying annotations in JSON codes

An automatic identification and annotation technology, applied in the computer field, can solve problems such as no quotation marks, no support for comments, no support for key names, etc., to achieve the effect of improving development efficiency and reducing communication costs

Active Publication Date: 2020-01-24
SUNING CLOUD COMPUTING CO LTD
View PDF9 Cites 5 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] Although JSON has many advantages, there are still some problems in actual usage scenarios, such as: comments are not supported, strings with single quotes are not supported, and key names without quotation marks are not supported

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 and device for automatically identifying annotations in JSON codes
  • Method and device for automatically identifying annotations in JSON codes
  • Method and device for automatically identifying annotations in JSON codes

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0053] Such as figure 1 As shown, a method to automatically identify comments in JSON code, including:

[0054] Parsing the JSON code into a syntax tree, traversing the syntax tree, and identifying all field names in the JSON code and a value corresponding to each field name during the traversal process;

[0055] Match the first character that is consistent with the comment start identifier after each value, if the match is successful, match the first character that is consistent with the comment end identifier after the comment start identifier, and identify the comment start The content between the identifier and the comment end identifier is a comment of the field name of the field name corresponding to the value.

[0056] The method disclosed in the present invention involves JSON codes with annotations. Considering that code programmers are used to writing annotations at the end of the line in general, that is, behind the value, the above-mentioned disclosed annotation i...

Embodiment 2

[0093] In this embodiment, on the basis of Embodiment 1, the present invention is described and explained in detail in combination with the application of specific scenarios.

[0094] The original JSON code is:

[0095]

[0096] The above original JSON code is of object type, which means that the employee object is an array containing 3 employee records (objects). Its errors are:

[0097] 1) employees non-standard symbol package;

[0098] 2) There is no string type character in front of the firstName in the first object in the array;

[0099] 3) The symbol in front of lastName in the second object in the array is not a string type symbol;

[0100] 4) Carter in the third object in the array is followed by non-standard characters.

[0101] The content between double slashes and newlines is the comment of the nearest field name in front of it, that is, the comment start identifier is " / / ", and the comment end identifier is The type character set includes: object type sta...

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 and device for automatically identifying annotations in JSON codes. The method comprises the steps that a JSON code is analyzed into a syntax tree, the syntax tree istraversed, and all field names in the JSON code and values corresponding to the field names are recognized in the traversing process; the first character consistent with the annotation starting identifier behind each value is matched; and if matching succeeds, the first character consistent with the annotation ending identifier is matched after the annotation starting identifier, and that the content between the annotation starting identifier and the annotation ending identifier is the annotation of the field name of the field name corresponding to the value is identified. According to the method, correct storage of annotations in the JSON codes can be supported, programmers are greatly helped to understand annotation meanings and rules of each field name in the JSON codes, the communication cost between the programmers is reduced, and the development efficiency is improved.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a method and device for automatically identifying annotations in JSON codes. Background technique [0002] JSON code is an open standard format for data exchange between data objects composed of attribute-value pairs. It is mainly used to transmit data between servers and web applications as an alternative to XML. Although originally derived from the JavaScript scripting language, JSON is a language-independent data format, and the code for parsing and producing JSON data is readily available in various programming languages. [0003] Currently at the enterprise level, the JSON data format has gained a lot of attention because it is more flexible and easier to use than other web-based data formats, and is a highly preferred data format in the mobile world. JSON code is promoted as a low-overhead alternative to other data formats that broadly support creation, reading, and deco...

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
Patent Type & Authority Applications(China)
IPC IPC(8): G06F16/2457G06F16/22G06F40/151
CPCG06F16/24573G06F16/2246
Inventor 凤凯王昱旸于鹏
Owner SUNING CLOUD COMPUTING 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