Login ProductsSalesSupportDownloadsAbout |
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 |
Stephen Barker | 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?
uses EWBHTTPCommon... TRequest = class(TObject) private FDB : TDBISAMDataBase; FSession : TDBISAMSession; FQuery : TDBISAMQuery; FJson : TEWBJSONWriter; FParams : TStringList; ... procedure TRequest.EchoParameters; var i : integer; begin FJson.BeginObject; FJson.PropertyName('Received Parameters'); if FParams.Count = 0 then FJson.NullValue else begin FJson.BeginArray(true); for i :=0 to FParams.Count-1 do begin if i > 0 then FJson.Separator; <<---------- should be automatic? FJson.BeginObject; FJson.StringProperty(FParams.Names[i], FParams.Values[FParams.Names[i]]); FJson.EndObject; end; FJson.EndArray(true); end; FJson.EndObject; end; Steve |
Wed, Aug 16 2017 5:02 AM | Permanent Link |
Matthew Jones | 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. timyoung@elevatesoft.com | Stephen,
<< 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). Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 02:26 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |