A Bonjour/DNS text record can only store a flat list of key/value pairs, not an arbitrary nested dictionary.
From DNS-SD (Rendezvous) TXT record format:
DNS-SD uses DNS TXT records to store arbitrary name/value pairs conveying additional information about the named service. Each name/value pair is encoded as it's own constituent string within the DNS TXT record, in the form "name=value". Everything up to the first '=' character is the name. Everything after the first '=' character to the end of the string (including subsequent '=' characters, if any) is the value.