利用QJSON将FDQuery转成JSON串

服务器要支持Http协议,打算采用Http+JSON的方式来交换数据。一开始考虑使用superobject,因为以前使用比较多,比较熟悉。

代码如下:

 class function FDQueryToSJSON(aQuery : TFDQuery) : string;

 class function TFDQueryJSONReflect.FDQueryToSJSON(aQuery: TFDQuery): string;
var
sj,aj,sj2,aj2:ISuperObject;
i:Integer;
Fieldtyp,JsonTyp:string;
List:TStringList;
aField : TField;
Fields : string;
begin
// 得到一个JSON对象
sj := SO();
//创建列
aj := SA([]);
List := TStringList.Create;
try
List.Sorted := True; Fields := '{';
for i := to aQuery.FieldCount - do
begin
sj2 := SO();
GetFieldTypeInfo(aQuery.Fields[i],Fieldtyp,JsonTyp); sj2.S[cstFieldName] := aQuery.Fields[i].FieldName;
sj2.S[cstFieldType] := Fieldtyp;
sj2.S[cstJsonType] := JsonTyp;
sj2.I[cstFieldSize] := aQuery.Fields[i].Size;
sj2.B[cstRequired] := aQuery.Fields[i].Required;
sj2.I[cstFieldIndex] := aQuery.Fields[i].Index;
aj.AsArray.Add(sj2);
List.Add(aQuery.Fields[i].FieldName+'='+JsonTyp);
Fields := Fields+aQuery.Fields[i].FieldName+':'+''+',';
end;
Fields := Fields.TrimRight([',']);
Fields := Fields+'}'; sj.O['Fields'] := SO(Fields);
sj.O['Cols'] := aj;
//创建数据集的数据
aQuery.DisableControls;
aQuery.First; aj2 := SA([]);
while not aQuery.Eof do
begin
sj2 := SO();
for i := to List.Count - do
begin
aField := aQuery.Fields.FindField(List.Names[i]); if VarIsNull(aField.Value) then
sj2.O[aField.FieldName] := SO(Null)
else
begin
CreateJsonValueByField(sj2,aField);
end;
end;
aj2.AsArray.Add(sj2);
aQuery.Next;
end; sj.O['Data'] := aj2;
Result := sj.AsString;
finally
List.Free;
aQuery.EnableControls;
end;
end;
 class function CreateJsonValueByField(Json:ISuperObject;Field:TField):Boolean; overload;

 class function TFDQueryJSONReflect.CreateJsonValueByField(Json: ISuperObject;
Field: TField): Boolean;
begin
Result := False;
if (Field Is TDateTimeField) or (Field is TSQLTimeStampField) then
Json.O[Field.FieldName] := SO(Field.AsDateTime)
else if Field is TBlobField then
Json.S[Field.FieldName] := EncodeString(Field.AsString)
else
Json.O[Field.FieldName] := SO(Field.Value);
Result := True;
end;

这样写,没问题,可以得到结果,但是我觉得冗余的数据比较多,有些信息是不需要每行都返回的。比如字段名,每条记录都返回了。

但是当我想去掉Data的字段名时,才注意到JSON串里面的顺序和字段的顺序居然不是一致的,无论我怎么插入,只要是用SuperObject的接口去生成JSON串,

顺序都会被自动按照一种我目前没理解的方式排序。除非我自己用字符串去拼装JSON串。

该方法得到的结果如下:

{"Fields":{"base_schema_ver":0,"sysstat":0,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":0,"refdate":0,"userstat":0,"status":0,"crdate":0,"xtype":0,"indexdel":0,"version":0,"id":0,"stats_schema_ver":0,"seltrig":0,"type":0,"name":0,"info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":0,"instrig":0},"Data":[{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761910,"userstat":1,"status":0,"crdate":1270198761910,"xtype":"S","indexdel":0,"version":0,"id":3,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysrscols","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761277,"userstat":1,"status":0,"crdate":1270198761277,"xtype":"S","indexdel":0,"version":0,"id":5,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysrowsets","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761273,"userstat":1,"status":0,"crdate":1270198761273,"xtype":"S","indexdel":0,"version":0,"id":7,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysallocunits","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1049764417267,"userstat":1,"status":0,"crdate":1049764417267,"xtype":"S","indexdel":0,"version":0,"id":8,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysfiles1","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198762227,"userstat":1,"status":0,"crdate":1270198762227,"xtype":"S","indexdel":0,"version":0,"id":17,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"syspriorities","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761840,"userstat":1,"status":0,"crdate":1270198761840,"xtype":"S","indexdel":0,"version":0,"id":18,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysdbfrag","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761853,"userstat":1,"status":0,"crdate":1270198761853,"xtype":"S","indexdel":0,"version":0,"id":19,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysfgfrag","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761847,"userstat":1,"status":0,"crdate":1270198761847,"xtype":"S","indexdel":0,"version":0,"id":21,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"syspru","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761850,"userstat":1,"status":0,"crdate":1270198761850,"xtype":"S","indexdel":0,"version":0,"id":22,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysbrickfiles","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761857,"userstat":1,"status":0,"crdate":1270198761857,"xtype":"S","indexdel":0,"version":0,"id":23,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysphfg","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761860,"userstat":1,"status":0,"crdate":1270198761860,"xtype":"S","indexdel":0,"version":0,"id":24,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysprufiles","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761360,"userstat":1,"status":0,"crdate":1270198761360,"xtype":"S","indexdel":0,"version":0,"id":25,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysftinds","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761357,"userstat":1,"status":0,"crdate":1270198761357,"xtype":"S","indexdel":0,"version":0,"id":27,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysowners","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761300,"userstat":1,"status":0,"crdate":1270198761300,"xtype":"S","indexdel":0,"version":0,"id":28,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysdbreg","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761267,"userstat":1,"status":0,"crdate":1270198761267,"xtype":"S","indexdel":0,"version":0,"id":29,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysprivs","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761323,"userstat":1,"status":0,"crdate":1270198761323,"xtype":"S","indexdel":0,"version":0,"id":34,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysschobjs","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761520,"userstat":1,"status":0,"crdate":1270198761520,"xtype":"S","indexdel":0,"version":0,"id":39,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"syslogshippers","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761337,"userstat":1,"status":0,"crdate":1270198761337,"xtype":"S","indexdel":0,"version":0,"id":41,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"syscolpars","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761313,"userstat":1,"status":0,"crdate":1270198761313,"xtype":"S","indexdel":0,"version":0,"id":42,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysxlgns","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0},{"base_schema_ver":0,"sysstat":1,"deltrig":0,"parent_obj":0,"schema_ver":0,"uid":4,"refdate":1270198761307,"userstat":1,"status":0,"crdate":1270198761307,"xtype":"S","indexdel":0,"version":0,"id":43,"stats_schema_ver":0,"seltrig":0,"type":"S","name":"sysxsrvs","info":0,"cache":0,"replinfo":0,"updtrig":0,"ftcatid":0,"category":2,"instrig":0}],"Cols":[{"JsonType":"string","FieldIndex":0,"FieldType":"WideString","FieldSize":128,"FieldName":"name","Required":true},{"JsonType":"integer","FieldIndex":1,"FieldType":"Integer","FieldSize":0,"FieldName":"id","Required":true},{"JsonType":"string","FieldIndex":2,"FieldType":"String","FieldSize":2,"FieldName":"xtype","Required":true},{"JsonType":"integer","FieldIndex":3,"FieldType":"Smallint","FieldSize":0,"FieldName":"uid","Required":false},{"JsonType":"integer","FieldIndex":4,"FieldType":"Smallint","FieldSize":0,"FieldName":"info","Required":false},{"JsonType":"integer","FieldIndex":5,"FieldType":"Integer","FieldSize":0,"FieldName":"status","Required":false},{"JsonType":"integer","FieldIndex":6,"FieldType":"Integer","FieldSize":0,"FieldName":"base_schema_ver","Required":false},{"JsonType":"integer","FieldIndex":7,"FieldType":"Integer","FieldSize":0,"FieldName":"replinfo","Required":false},{"JsonType":"integer","FieldIndex":8,"FieldType":"Integer","FieldSize":0,"FieldName":"parent_obj","Required":true},{"JsonType":"variant","FieldIndex":9,"FieldType":"TimeStamp","FieldSize":0,"FieldName":"crdate","Required":true},{"JsonType":"integer","FieldIndex":10,"FieldType":"Smallint","FieldSize":0,"FieldName":"ftcatid","Required":false},{"JsonType":"integer","FieldIndex":11,"FieldType":"Integer","FieldSize":0,"FieldName":"schema_ver","Required":false},{"JsonType":"integer","FieldIndex":12,"FieldType":"Integer","FieldSize":0,"FieldName":"stats_schema_ver","Required":false},{"JsonType":"string","FieldIndex":13,"FieldType":"String","FieldSize":2,"FieldName":"type","Required":false},{"JsonType":"integer","FieldIndex":14,"FieldType":"Smallint","FieldSize":0,"FieldName":"userstat","Required":false},{"JsonType":"integer","FieldIndex":15,"FieldType":"Smallint","FieldSize":0,"FieldName":"sysstat","Required":false},{"JsonType":"integer","FieldIndex":16,"FieldType":"Smallint","FieldSize":0,"FieldName":"indexdel","Required":false},{"JsonType":"variant","FieldIndex":17,"FieldType":"TimeStamp","FieldSize":0,"FieldName":"refdate","Required":true},{"JsonType":"integer","FieldIndex":18,"FieldType":"Integer","FieldSize":0,"FieldName":"version","Required":false},{"JsonType":"integer","FieldIndex":19,"FieldType":"Integer","FieldSize":0,"FieldName":"deltrig","Required":false},{"JsonType":"integer","FieldIndex":20,"FieldType":"Integer","FieldSize":0,"FieldName":"instrig","Required":false},{"JsonType":"integer","FieldIndex":21,"FieldType":"Integer","FieldSize":0,"FieldName":"updtrig","Required":false},{"JsonType":"integer","FieldIndex":22,"FieldType":"Integer","FieldSize":0,"FieldName":"seltrig","Required":false},{"JsonType":"integer","FieldIndex":23,"FieldType":"Integer","FieldSize":0,"FieldName":"category","Required":false},{"JsonType":"integer","FieldIndex":24,"FieldType":"Smallint","FieldSize":0,"FieldName":"cache","Required":false}]}

看到没?Cols和Data的字段顺序是不一致的!Fields是我在循环里面用字符串拼装的(最开始不是这样写的,我以为我手工拼装可以得到预期的顺序,但是因为用了 SO(Fields) 得到JSON

串,所以顺序依然和Cols保持了一致,而这个顺序不是 Select 语句的得到数据集的字段顺序(调试的时候,包括得到的运行时的字符串的内容都和数据集是一致的,但一旦生成为JSON串

以后,顺序就改变了。)。

于是,我决定用QJSON去尝试一下,QJSON得到的结果顺序和我预期是一致的。

代码如下:

 class function FDQueryToQJSON(aQuery : TFDQuery) : string;

 class function TFDQueryJSONReflect.FDQueryToQJSON(aQuery: TFDQuery): string;
var
i:Integer;
Fieldtyp,JsonTyp:string;
List:TStringList;
aField : TField;
aqjsonall, aqjson,aqjson2, aqFields, aqjsonTemp : TQJSON;
begin
aqjsonall := TQJSON.Create;
aqjson := aqjsonall.AddArray('Cols');
List := TStringList.Create;
try
List.Sorted := False; aqFields := aqjsonall.AddArray(cstFields); for i := to aQuery.FieldCount - do
begin
aqjsonTemp := TQJson.Create; GetFieldTypeInfo(aQuery.Fields[i],Fieldtyp,JsonTyp); aqjsonTemp.AddVariant(cstFieldName,aQuery.Fields[i].FieldName);
aqjsonTemp.AddVariant(cstFieldType,Fieldtyp);
aqjsonTemp.AddVariant(cstJsonType,JsonTyp);
aqjsonTemp.AddVariant(cstFieldSize, aQuery.Fields[i].Size);
aqjsonTemp.AddVariant(cstRequired, aQuery.Fields[i].Required);
aqjsonTemp.AddVariant(cstFieldIndex, aQuery.Fields[i].Index); aqjson.Add(aqjsonTemp);
List.Add(aQuery.Fields[i].FieldName+'='+JsonTyp); aqFields.Add.AsString := aQuery.Fields[i].FieldName;
end; //创建数据集的数据
aQuery.DisableControls;
aQuery.First; aqjson2 := aqjsonall.AddArray(cstData); while not aQuery.Eof do
begin
aqjsonTemp := aqjson2.AddArray('DataItem');
for i := to List.Count - do
begin
aField := aQuery.Fields.FindField(List.Names[i]); if VarIsNull(aField.Value) then
aqjsonTemp.Add.AsString := SO(Null).AsString
else
begin
CreateJsonValueByField(aqjsonTemp,aField);
end;
end;
aQuery.Next;
end;
Result := aqjsonall.AsString; finally
List.Free;
aQuery.EnableControls;
aqjsonall.Free;
end;
end;
 class function CreateJsonValueByField(Json:TQJSON;Field:TField):Boolean; overload;

 class function TFDQueryJSONReflect.CreateJsonValueByField(Json: TQJSON;
Field: TField): Boolean;
begin
Result := False;
if (Field Is TDateTimeField) or (Field is TSQLTimeStampField) then
Json.Add.AsString := FormatdateTime('yyyy-MM-dd hh:mm:ss', Field.AsDateTime)
else if Field is TBlobField then
Json.add.AsString := EncodeString(Field.AsString)
else
Json.Add.AsVariant := Field.Value;
Result := True;
end;

得到的结果如下:

{ "Cols":[ { "FieldName":"name", "FieldType":"WideString", "JsonType":"string", "FieldSize":128, "Required":true, "FieldIndex":0 }, { "FieldName":"id", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":true, "FieldIndex":1 }, { "FieldName":"xtype", "FieldType":"String", "JsonType":"string", "FieldSize":2, "Required":true, "FieldIndex":2 }, { "FieldName":"uid", "FieldType":"Smallint", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":3 }, { "FieldName":"info", "FieldType":"Smallint", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":4 }, { "FieldName":"status", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":5 }, { "FieldName":"base_schema_ver", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":6 }, { "FieldName":"replinfo", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":7 }, { "FieldName":"parent_obj", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":true, "FieldIndex":8 }, { "FieldName":"crdate", "FieldType":"TimeStamp", "JsonType":"variant", "FieldSize":0, "Required":true, "FieldIndex":9 }, { "FieldName":"ftcatid", "FieldType":"Smallint", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":10 }, { "FieldName":"schema_ver", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":11 }, { "FieldName":"stats_schema_ver", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":12 }, { "FieldName":"type", "FieldType":"String", "JsonType":"string", "FieldSize":2, "Required":false, "FieldIndex":13 }, { "FieldName":"userstat", "FieldType":"Smallint", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":14 }, { "FieldName":"sysstat", "FieldType":"Smallint", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":15 }, { "FieldName":"indexdel", "FieldType":"Smallint", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":16 }, { "FieldName":"refdate", "FieldType":"TimeStamp", "JsonType":"variant", "FieldSize":0, "Required":true, "FieldIndex":17 }, { "FieldName":"version", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":18 }, { "FieldName":"deltrig", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":19 }, { "FieldName":"instrig", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":20 }, { "FieldName":"updtrig", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":21 }, { "FieldName":"seltrig", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":22 }, { "FieldName":"category", "FieldType":"Integer", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":23 }, { "FieldName":"cache", "FieldType":"Smallint", "JsonType":"integer", "FieldSize":0, "Required":false, "FieldIndex":24 } ], "Fields":["name","id","xtype","uid","info","status","base_schema_ver","replinfo","parent_obj","crdate","ftcatid","schema_ver","stats_schema_ver","type","userstat","sysstat","indexdel","refdate","version","deltrig","instrig","updtrig","seltrig","category","cache"], "Data":[ ["sysrscols",3,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysrowsets",5,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysallocunits",7,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysfiles1",8,"S",4,0,0,0,0,0,"2003-04-08 09:13:37",0,0,0,"S",1,1,0,"2003-04-08 09:13:37",0,0,0,0,0,2,0], ["syspriorities",17,"S",4,0,0,0,0,0,"2010-04-02 16:59:22",0,0,0,"S",1,1,0,"2010-04-02 16:59:22",0,0,0,0,0,2,0], ["sysdbfrag",18,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysfgfrag",19,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["syspru",21,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysbrickfiles",22,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysphfg",23,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysprufiles",24,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysftinds",25,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysowners",27,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysdbreg",28,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysprivs",29,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysschobjs",34,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["syslogshippers",39,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["syscolpars",41,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysxlgns",42,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0], ["sysxsrvs",43,"S",4,0,0,0,0,0,"2010-04-02 16:59:21",0,0,0,"S",1,1,0,"2010-04-02 16:59:21",0,0,0,0,0,2,0] ] }

可以看到,数据量明显减少,而且并不影响数据的解析。因为Data数组里面的每条记录(也是数组)是和字段信息的顺序一致的。

上一篇:[Android Pro] Android 6.0 Root


下一篇:html常用标签有哪些