The following code
procedure TForm3.WebButton2Click(Sender: TObject);
var
o: TJsonObject;
begin
o := TJsonObject.ParseJSONValue('{ "Fvalue": "boo" }') as TJsonObject;
o.Values['Fvalue'].Value := 'Hello';
Memo.Lines.Add(o.ToJSON);
end;
fails to alter the contents of the JSON object. It displays a string of {"Fvalue":"boo"}
yet the following code
procedure TForm3.WebButton1Click(Sender: TObject);
var
o: TJsonObject;
begin
o := TJsonObject.ParseJSONValue('{ "Fvalue": "boo" }') as TJsonObject;
o.AddPair('Fvalue', 'Hello');
Memo.Lines.Add(o.ToJSON);
end;
works and displays a string of {"Fvalue":"Hello"}
I'[m not fussed about the 1st one as long as the 2nd option doesn't cause a memory leak. I'm assuming that under the hood, javascript is reference counting the TJsonString and releases it when the reference count reaches 0.
Can you confirm this ?