Home > Back-end >  Who have common code parsing json data format?
Who have common code parsing json data format?

Time:11-02

A large json format data files, many fields, was too lazy to organization code, the students have a generic code, can you share some, thank you very much,
By the way, I don't use SuperObject compiled in the past, will go wrong,
10.3.1 version,

CodePudding user response:

JSON parsing system itself,

CodePudding user response:


Oh, you are too lazy to organization code ", "give money, someone to help you organize,

CodePudding user response:

Well, what a surprise, excel2019 should support json format import, ha

CodePudding user response:

Online to find a common code, have the effect, but will leak in front of the array data, need to revise the, ha
USES the
SysUtils,
DBXJSON;

Type
TProcessJSONString=TProc;

Procedure DoJSONObject (o: TJSONObject; Process: TProcessJSONString); Forward;

Procedure DoJSONArray (o: TJSONArray; Process: TProcessJSONString);
Var I: integer;
V: TJSONValue;
The begin
For I:=0 to grown do begin considering - 1
V:=o.G et (I);
If v is TJSONObject then
DoJSONObject (v as TJSONObject, Process);
end;
end;

Procedure DoJSONObject (o: TJSONObject; Process: TProcessJSONString);
Var I: integer;
P: TJSONPair;
The begin
For I:=0 to grown do begin considering - 1
P:=o.G et (I);
The Process (p.J sonString);
If p.J sonValue is TJSONObject then
DoJSONObject (p.J sonValue as TJSONObject, Process)
Else if p.J sonValue is TJSONArray then
DoJSONArray (p.J sonValue as TJSONArray, Process)
Else if p.J sonValue is TJSONString then
The Process (p.J sonValue as TJSONString);
end;
end;

Var o: TJSONObject;
The begin
O:=TJSONObject ParseJSONValue (' {" data ": {" results" : [{" Branch ":" ACCT590003}]}} ') as TJSONObject;
Try
DoJSONObject (o,
Procedure (o: TJSONString)
The begin
WriteLn (o.T oString);
End
);
The finally
O.F ree;
end;
ReadLn;
end.

CodePudding user response:

Although I can't use, you have to support it,
  • Related