Serde icon indicating copy to clipboard operation
Serde copied to clipboard

2-level object arrays

Open geek-merlin opened this issue 2 weeks ago • 5 comments

Problem: Multi-level object arrays

I'm running into another limit with a 2-level array like this:

class Ledger {
  /**
   *  @param InfoObject[][] $info,
   */
  public function __contruct(
    private readonly array $info,
  ) {}
  public function getInfo(string $account, string $currencyCode) {
    return $this->info[$account][$currencyCode];
  }
}

I don't see how to describe this to serde, and am going to work around it w/ some boilerplate for an internal intermediate object that limits the arrays to 1 level.

geek-merlin avatar Dec 18 '25 12:12 geek-merlin