首页 > 代码库 > json中关于jo.[]中字符串一致的问题
json中关于jo.[]中字符串一致的问题
procedure TForm1.btn1Click(Sender: TObject);
var
jo:ISuperObject;
Temp:string;
temp1:Boolean;
begin
jo:=SO(mmo1.Text);
ShowMessage(jo.AsJSon(False,True));
temp:=jo[‘name‘].AsString;
ShowMessage(temp);
temp:= jo[‘sex‘].AsString; //jo[]中额的字符串大小写要一致不一致会报错比如Sex就会报错
ShowMessage(temp);
temp:=jo[‘weight‘].AsString;
ShowMessage(temp);
temp:=jo[‘addresses‘].Asstring;
ShowMessage(temp);
ShowMessage(jo[‘tel‘].AsString);
showmessage(jo[‘children‘].AsString);
end;
///memo.text
{
"name": "张三", /* 注释 */
"age": 33,
"sex": true,
"weight": 123.456,
"tel": ["86-1111111", "86-2222222"],
"addresses":{"address":"A省B市", "pc":"100001"},
"children": [
{
"name": "张继",
"age": "22",
"sex": true
},
{
"name": "张承",
"age": "11",
"sex": false
}
]
}
json中关于jo.[]中字符串一致的问题