[fpc-pascal] JSONToObject with array of any type

Hairy Pixels genericptr at gmail.com
Sat Oct 1 06:28:28 CEST 2022


I have some JSON with a “arguments” value which can be an array of JSON type. When it’s received and parsed with TJSONDeStreamer.JSONToObject how can I represent this “any” type? I tried using TJSONArray but it always returns an empty array.

The JSON is parse:

{
    "command": "do_stuff",
    "arguments": ["path", 1, 80]
}

The object to stream to:

  TExecuteCommandParams = class
    private
      fCommand: String;
      fArguments: TJSONArray;
    published
      property command: String read fCommand write fCommand;
      property arguments: TJSONArray read fArguments write fArguments;
  end;


Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list