On Sat, 1 Oct 2022, Hairy Pixels via fpc-pascal wrote:

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;

The standard streamer does not allow this (yet). It is on my todo list to
improve it.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to