Supercharge Your Innovation With Domain-Expert AI Agents!

Implementation method for filtering fields in interface JSON message

A JSON and filtering interface technology, applied in the field of network communication, can solve the problems of large quantity, high maintenance cost of later codes, and large variability of related field information, so as to achieve high maintenance costs and improve work efficiency

Pending Publication Date: 2022-02-25
上海通联金融服务有限公司
View PDF1 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] In view of the above-mentioned shortcomings existing in the prior art, the present invention aims at filtering the relevant field values ​​in the json message, that is, in the work of assigning an empty string, the relevant field information is highly variable, large in quantity, and high in post-code maintenance costs. Provides a flexible and safe dynamic configuration solution, which converts the request message object into JSONObject format, then configures the filter field parameters in the database, stores them in the parameter list object for processing, and calls the recursive method to quickly process the JSON report text, so that the format of the processed json message meets the filtering requirements and then sent to the outside, improving the efficiency of json message filtering and processing

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
  • Implementation method for filtering fields in interface JSON message
  • Implementation method for filtering fields in interface JSON message

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0042] A method for implementing fields in an interface JSON message, comprising the following steps:

[0043] Step 1. Convert the request message object to JSONObject format:

example 1

[0045] The converted json format message is as follows:

[0046]

[0047]

[0048] Step 2. Obtain the configuration of "filter field parameters" in the database and store it in the "parameter list map1" object. The parameter configuration format is as follows:

[0049] a. The first-level parameter name of the json message is fixed:

[0050] Json_"Whether the field content can be transmitted (true / false)"_"first"_"Number of parameters (because there are too many fields, you need to configure more than one)": fields (separated by commas).

[0051] b. Sub-level parameter configuration of json message:

[0052] Json_"Whether the field content is transferable (true / false)"_"Field name with children"_"Number of parameters": fields (separated by commas).

example 2

[0054] ①key="Json_true_first_1", value="code, message, data";

[0055] ②key="Json_true_data_1", value="code, paraml";

[0056] ③key="Json_false_param1_1", value="score";

[0057] ④key="Json_false_param1_2", value="reg".

[0058] Among them, such as the message in Example 1:

[0059] "code": 200, "message": "success",

[0060] "data":

[0061] It is the first level of the json message, and the parameter name is fixed as "Json_true_first_1".

[0062] As configured in ①, all fields will not be filtered;

[0063] "code": "SUCCESS", "errorMessage": "Call succeeded";

[0064] "param1": ";

[0065] "param2":" is the second level of the json message, that is, the child of the first level field data, and the parameter name is "Json_true_data_1".

[0066] As configured in ②, the fields to be filtered are errorMessage and param2, that is, the values ​​of the fields errorMessage and param2 are assigned to empty strings;

[0067] "score": "123", "loan": "asd", "reg": "123", "user": ...

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 relates to the technical field of power system protection, in particular to an implementation method for filtering a field in an interface JSON message. The implementation method comprises the following steps: S1, converting a request message object into a JSONobjet format; S2, obtaining filtering field parameter configuration in a database, and storing the filtering field parameter configuration in a parameter list map1 object; and S3, traversing the parameter list map1 to process the parameters. The invention provides a flexible and safe dynamic configuration scheme aiming at the problems of large variability, large quantity and high later-stage code maintenance cost of related field information in related field value filtering, namely empty character string assignment work in the JSON message, a request message object is converted into a JSONobject format, then filtering field parameters in a database are configured, stored in the parameter list object to be processed, and a recursion method is called to quickly process the json message, so that the processed json message is sent to the outside after the format of the json message meets the filtering requirement, and the json message filtering processing working efficiency is improved.

Description

technical field [0001] The invention relates to the technical field of network communication, in particular to a method for realizing fields in a filtering interface JSON message. Background technique [0002] JSON is a lightweight data exchange format. During server testing, it is often necessary to compare the returned JSON messages in order to find out the differences and determine whether the contents of the JSON messages returned by the server are In line with expectations. [0003] In the prior art, such as Chinese Patent No.: CN 109413077 A "a JSON message data sending and receiving method, device and electronic equipment", including: obtaining the JSON message to be sent, according to the pre-stored development attribute name and transmission A comparison table of attribute names, replace the development attribute name in the JSON message to be sent with the transmission attribute name corresponding to the development attribute name, and package and send the replace...

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): G06F16/25G06F16/22G06F16/9035H04L67/02
CPCG06F16/258G06F16/2282G06F16/9035H04L67/02
Inventor 王新月
Owner 上海通联金融服务有限公司
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