Using a TJSONObject
, I've noticed that its AddPair
function has the following overloads:
function AddPair(const Pair: TJSONPair): TJSONObject; overload;
function AddPair(const Str: TJSONString; const Val: TJSONValue): TJSONObject; overload;
function AddPair(const Str: string; const Val: TJSONValue): TJSONObject; overload;
function AddPair(const Str: string; const Val: string): TJSONObject; overload;
In particular, I've noticed that there's no overload for adding not-string values like integers, datetimes...
Due to this reason, calling ToString
function, every value is shown as double quoted:
{"MyIntegerValue":"100"}
From what I've read in this answer, it goes against the JSON standard for not-string values.
How should a not-string value be added to a TJSONObject
?