- This topic has 1 reply, 2 voices, and was last updated 4 years ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Hello
kbmMW is version 5.15.10
procedure TkbmMWJSONStreamer.SaveToStringBuilder builds wrong JSON if DontStreamNullProperties = True and the last element is null
The error is in next code:
for i:=0 to n do
begin
co:=TkbmMWONCustomObject(o.PropertyValue[i]);
if (co is TkbmMWONNative) and (FDontStreamNullProperties) and (TkbmMWJSONNative(co).IsNull) then
continue;
iStart2:=ASB.Length;
if Pretty then
ASB.Append(‘ ‘,(ALevel+1)*Indent);
ASB.Append(kbmMWJSONQuoteString(o.PropertyName[i],FJQueryEscaping)+’:’);
SaveToStringBuilder(ALevel+1,ASB,ARoot,co,AOnEachCustomObject);
//// Why if i<n ? All next elements can be IsNull = True and ‘,’ will be excess
if i<n then
ASB.Append(‘,’);
if Pretty then
ASB.Append(#13#10);
///
DoOnObject(co,iStart2);
end;
In kbmMW version 5.01.00 you use to the next code:
for i:=0 to o.PropertyCount-1 do
begin
co:=TkbmMWONCustomObject(o.PropertyValue[i]);
if (co is TkbmMWONNative) and (FDontStreamNullProperties) and (TkbmMWJSONNative(co).IsNull) then
continue;
//// Before te second element and before all next elements
if b then
ASB.Append(‘,’);
b:=true;
////
ASB.Append(kbmMWJSONQuoteString(o.PropertyName[i],FJQueryEscaping)+’:’);
SaveToStringBuilder(ASB,ARoot,co);
end;
ASB.Append(‘}’);
Hi,
Thank you for your bug report.
It is fixed in next release.
Kim/C4D