Skip to content

Json AsText does not Unescape double quote character #1764

@kine

Description

@kine

One short example:

            var
                JsonObj: JsonObject;
                JsonTok: JsonToken;
                Data: text;
            begin
                JsonObj.Add('Test','Version="1.1.0.1"');
                JsonObj.SelectToken('Test',JsonTok);
                Data:= JsonTok.AsValue.AsText;
                Message('%1',Data);
           end;

If you run this code, the message will give you>

Version=\"1.1.0.1\"

This is not correct for me. I will expect the original value. Charaters like \u003e and \u003c are unescaped correctly.

The "why" for me is, that as part of JSon I am transferring XML data, which I need to parse. I cannot load them because I am getting

The following exception was encountered when processing XML data: ''' is an unexpected token. The expected token is '"' or '''

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions