|Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder Web Server and Modules » View Thread|
|Messages 1 to 3 of 3 total|
|Json array element separator not automatic|
|Wed, Aug 16 2017 12:04 AM||Permanent Link|
In my server (Delphi), I seem to have to manually add array element separators when using the TEWBJSONWriter class. Shouldn't this be automatic, or is this the correct way to do it?
TRequest = class(TObject)
FDB : TDBISAMDataBase;
FSession : TDBISAMSession;
FQuery : TDBISAMQuery;
FJson : TEWBJSONWriter;
FParams : TStringList;
i : integer;
if FParams.Count = 0 then
for i :=0 to FParams.Count-1 do begin
if i > 0 then
FJson.Separator; <<---------- should be automatic?
|Wed, Aug 16 2017 5:02 AM||Permanent Link|
Stephen Barker wrote:
> Shouldn't this be automatic, or is this the correct way to do it?
The building of JSON is quite basic, so it is not automatic. If you try to get clever, you can catch yourself out, so the simple test is the easiest.
|Thu, Aug 17 2017 1:48 PM||Permanent Link|
Tim Young [Elevate Software]
Elevate Software, Inc.
<< In my server (Delphi), I seem to have to manually add array element separators when using the TEWBJSONWriter class. Shouldn't this be automatic, or is this the correct way to do it? >>
No, they're not automatic. I'll have to double-check, but I think the properties *do* handle this automatically and it was just a miss on the arrays. If so, then I can log this as a breaking change for the next release (not build).