Delphi 处理JSON数据

Delphi中对JSON的解析处理可以使用 ISuperObject。

function SO(const s: SOString = '{}'): ISuperObject; overload;
property O[const path: SOString]: ISuperObject read GetO write PutO; default;
property S[const path: SOString]: SOString read GetS write PutS;

//SO 函数作用就是解析JSON字符串,变成ISuperObject对象   例: jObj := SO(jsonstr)。
//O  函数是根据key取值,返回值为ISuperObject对象 例: jobj_son := jobj.O['username']
//S  函数是根据key取值,返回值为String 例: str := jobj.S['username']
//I B A 函数类似于S,但是返回值分别为Integer,Boolean,TSuperArray
//AsString,AsBoolean,AsInteger,AsArray 这几个函数,用来把ISuperObject转换成相应的数据类型。

转载于: http://bcoder.com/delphi/parse-json-data-in-delphi-by-using-isuperobject

posted @ 2022-07-11 15:23  图图雷  阅读(1018)  评论(0)    收藏  举报