TJsonObject.AddPair(TJsonPair) does nothing

If I create a TJsonObject and perform an AddPair('value', 'test') it correctly add the value.

If I then execute AddPair('value', 'new data') it still has the value 'test' in it.

I'm sure the previous version (v6.0.0) allowed this to replace the value. Has this changed, and if so, what is the correct method of updating a value (Values property is R/O so I cant use that) ?

1 Like

I could not reproduce an issue.

This returns 'First' and then 'Second'.

var
  js: TJSONObject;
begin
  js := TJSONObject.Create;
  js.AddPair('name','First');
  console.log(js.Values['name'].Value);
  js.AddPair('name','Second');
  console.log(js.Values['name'].Value);
end;