Delphi Xe-system.json

Source: Internet
Author: User

Delphi XE10 has a JSON-processing unit that introduces "System.json" in the cells you need to use JSON, and then you can use Delphi's own JSON processing classes.

Jsonstring = ' {
"_id": "4",
"Dev": "4",
"Type": "Physical",
"Math": {
"Consts": {
"CT": 1,
"PT": 1
},
"Exprs": {}
},
"Name": "Iron-Smelting # # Dust High Pressure room"
}‘

Procedure Tfrm_0201_dev. Act_f_020102_editexecute (Sender:tobject);
Var
Devobject,mathobj,contstsobj:tjsonobject; JSON class
smath,scontsts,sct,spt:string;
Begin
If Lv_dev. Selected=nil then raise Exception.create (' Please select Device ');

Dselector:=json ([' Dev ', Lv_dev. Selected.caption]);
D:=fmongowire.get (Devcol,dselector);


Devobject:=tjsonobject.parsejsonvalue (jsonstring) as Tjsonobject; Generating JSON from a string
Smath:=devobject.getvalue (' math '). ToString;
Mathobj:=tjsonobject.parsejsonvalue (Smath) as Tjsonobject;
Scontsts:=mathobj.getvalue (' consts '). ToString;
Contstsobj:=tjsonobject.parsejsonvalue (scontsts) as Tjsonobject;



SCT: = Contstsobj.getvalue (' CT '). ToString; Get CT
SPT: = Contstsobj.getvalue (' PT '). ToString;

Frm_020101_devadd.showmodal;
End

Property

Property Count:integer Read getcount;//to get the outermost data count

Example: Num:=devobject.count; Result is 5

So that regular data can be recycled.

Delphi Xe-system.json

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.