Deserialize problem (Bcl.Json)

Hi,

I get an error when calling:

TJson.Deserialize(MyJsonString);

MyJsonString ->

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

My class:

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

  TJSONPositionClass = class
  private
    Fposition: TPositionArray;
    Futc_time: string;
    [JsonProperty('static')]
    Fstatic_: boolean;
    Fnum_sv: integer;
  public
    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;
  end;

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

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

I get an error when calling:

TJson.Deserialize<TJSONPositionClass>(MyJsonString);

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.

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