[fpc-pascal] TJSONParser crash

Sven Barth pascaldragon at googlemail.com
Wed Sep 28 17:04:23 CEST 2022


Hairy Pixels via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Mi., 28. Sep. 2022, 16:17:

> Ok I narrowed down this bug I get with 3.2.2 to TJSONParser.
>
> I’m so confused as to what changed.  FormatJSON prints the JSON as
> expected but AsString crashes and gives the error I was seeing from the RPC
> which it trapped as an exception. When it’s send across the RPC layer it
> must call AsString and then blow up thus giving me this error.
>
> The JSON in question printed from FormatJSON is valid and can be opened in
> a JSON editor even so I know it’s ok.
>
> ===========================
>
> Request := TJSONParser.Create(Content, DefaultOptions).Parse;
>
> writeln(Request.FormatJSON);  // this prints the JSON correctly (Request
> ClassName is TJSONObject)
>
> writeln(Request.AsString);
>
> gives this error:
>
> An unhandled exception occurred at $00000001050261A7:
> EJSON: Cannot convert data from object value
>   $00000001050261A7
>

How about you provide a more complete example instead of making us guess so
that we can reproduce it?

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20220928/e85c3eb1/attachment.htm>


More information about the fpc-pascal mailing list