Skip to content

Instantly share code, notes, and snippets.

@mrezentes
mrezentes / MapMaker.md
Last active March 1, 2024 12:35
Convert a nested struct to a map

Problem: Convert nested structs or nested encoded maps into a decoded map and remove keys with nil values.

Solution: Walk the structure and convert all structures to decoded map.

Before (nested struct):

%TopLevelStuct{
      _type: "Purchase",
      account_key: "ZBmrcY7sv47nCaZOx5TXBTJuazy"