Home > Back-end >  Delphi superobject array
Delphi superobject array

Time:11-11

Var
Jo, 'arry, bb: ISuperObject;
StrSQL, sResult, STMP: string;
SZTBH: string;
Arry1: TSuperArray;
The begin
STMP:='{" GQCPBH ": [{" CPBH" : "0101"}, {" CPBH ":" 0602 "}], "resmsg" : "data query success", "resid" : "0"} ";
Jo: SO=(STMP);
Bb:=SO (' {eee: seee, ooo: st} ');
Jo: [' a ']=SA ([]);
Jo. A [' A ']. Add (bb);
Jo. A [' A ']. Add (so (' {} then, '));
Memo1. Lines. The Add (Jo. AsJSon (true, true));

In theory:
{
"A" :
{
"Eee" : "seee,"
"Ooo" : "st"
},
{
"11" : 33
}
],
"GQCPBH" : [
{
"CPBH" : "0101"
},
{
"CPBH" : "0602"
}
],
"Resid" : "0",
Data query "resmsg" "success"
}

Actual it is concluded that:
{
"GQCPBH" :
{
"CPBH" : "0101"
},
{
"CPBH" : "0602"
},
"A" :
{
"Ooo" : "st",
"Eee" : "seee
"},
{
"11" : 33
},
"Resmsg: \ u6570 \ u636e \ u67e5 \ u8be2 \ u6210 \ u529f",
"Resid" : "0"
}

Question:
1. The array brackets are not;
2. Chinese into coding;

Please explain how to write to get theoretical results?

CodePudding user response:

Note: I use the SuperObject version for V1.5

CodePudding user response:

Use your code to test no problem, but my SuperObject is 1.2, D7 high version,
The code to AsJSon the second parameter is set to False,

CodePudding user response:

Delphi high version of the built-in JSON library, can try

CodePudding user response:

refer to the second floor boring pig reply:
test there is no problem with your code, but I SuperObject is 1.2, D7 high version,
The gibberish AsJSon the second parameter is set to False,


What do you mean what you said there is no problem? The brackets still exist? Why should exist, after transformation was gone?
The code is the default use unicode problem, change the second parameter is FALSE with respect to OK,

CodePudding user response:

Drifer
reference 4 floor response:
Quote: refer to the second floor boring pig reply:

Use your code to test no problem, but my SuperObject is 1.2, D7 high version,
The gibberish AsJSon the second parameter is set to False,


What do you mean what you said there is no problem? The brackets still exist? Why should exist, after transformation was gone?
The code is the default use unicode problem, change the second parameter is FALSE with respect to OK,


Brackets, format is normal, can be identified correctly, may be your superobject has a problem, change a try?

CodePudding user response:

refer to the second floor boring pig reply:
test there is no problem with your code, but I SuperObject is 1.2, D7 high version,
The gibberish AsJSon the second parameter is set to False,


D7, SuperObject1.2 version perform correct,
  • Related