I need addPair()
to JSON object where the value is a trailing blackslash /. The result is beeing equals to this: "\/".
Then, how remove the left trailing blackslash inserted by JSON?
Edition:
Tested StringReplace()
and not works.
uses
System.JSON, REST.Json;
//...
function FormatJSON(json: string): string;
var
tmpJson: TJsonValue;
begin
tmpJson := TJSONObject.ParseJSONValue(json);
Result := TJson.Format(tmpJson);
FreeAndNil(tmpJson);
end;
function xxxxxx: String;
var
TempObject: TJSONOBject;
TempArray: TJSONArray;
begin
TempObject := TJSONOBject.Create;
TempArray := TJSONArray.Create;
TempObject.AddPair('value', '/');
TempArray.AddElement(TempObject);
Result := FormatJSON(TempArray.ToJSON);
end;