iOS過濾json注釋字段

2021-09-03 01:53:58 字數 632 閱讀 4691

我們的後台習慣在介面文件的json示例中直接新增注釋,有時候測試環境不滿足條件無法測試某部分資料,使用介面文件中的json直接轉換成模擬資料就相當方便,但是注釋和一些不符合的資料要手動逐一修改。為此做了乙個過濾特殊欄位的方法。

我在這篇文章中查詢到了關於過濾非法欄位的方法,但是還是不能滿足過濾注釋的需求。

比如下面一段json

"data"

:...

///讀取模擬介面文件資料

- (nsdictionary *)readinte***cevalue

if (jsonstr == nil)

nsdata *jsondata = [jsonstr datausingencoding:nsutf8stringencoding];

nserror *error;

nsdictionary *resultdic = [nsjsonserialization jsonobjectwithdata:jsondata options:nsjsonreadingmutablecontainers error:&error];

if(error)

return resultdic;

}

json過濾部分字段

public string queryalltrades 此處是亮點,只要將所需忽略欄位加到陣列中即可,在實際測試中,我發現在所返回陣列中,存在大量無用屬性,如 ratepersonals channelpersonals 那麼也可以將這兩個加到忽略陣列中.jsonarray jsonarr jso...

mysql 獲取表注釋 字段注釋

表注釋儲存在information schema.tables表內 show table status 獲取當前庫下的所有表資訊 包括注釋 select table comment from information schema.tables同上 字段注釋儲存在information schema....

mysql 表注釋和字段注釋

1 建立表的時候寫注釋 create table test1 field name int comment 欄位的注釋 comment 表的注釋 2 修改表的注釋 alter table test1 comment 修改後的表的注釋 3 修改欄位的注釋 alter table test1 modif...