Deserialize problem (Bcl.Json)


I get an error when calling:


MyJsonString ->

{"position": [58.898008, 5.699487, 17.5], "utc_time": "2023-12-04T08:15:46", "static": false, "num_sv": 8}

My class:

    Bcl.Json, Bcl.Json.Attributes;
  TPositionArray = array[0..2] of double;

  TJSONPositionClass = class
    Fposition: TPositionArray;
    Futc_time: string;
    Fstatic_: boolean;
    Fnum_sv: integer;
    property position: TPositionArray read Fposition write Fposition;
    property utc_time: string read Futc_time write Futc_time;
    property static_: boolean read Fstatic_ write Fstatic_;
    property num_sv: integer read Fnum_sv write Fnum_sv;

The error raised is:

Project MyProject.exe raised exception class EJsonConverterNotFound with message 'Could not find JSON converter for type "TPositionArray"'.

Sorry if I'm overlooking something obvious here, but does anyone have a hint or insight to share to resolve my issue?

Thank you in advance,
Leif Eirik

1 Like

An 'Error' was made in my initial post. At the top of my post it should read:

I get an error when calling:


The message hints the problem, which is the fact that it can't serialize the field of type TPositionArray. It's not supported.

It supports TArray<Double> though, so you can use that instead of array of double.

1 Like

Thank you, really not sure why I didn't just try TArray<double> when I saw the exception, but thank you for reminding me.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.