<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Zerobus Variant Data not Processed as Expected (json data destined for Variant column). in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/zerobus-variant-data-not-processed-as-expected-json-data/m-p/173687#M56749</link>
    <description>&lt;P&gt;Thanks for the tip.&amp;nbsp; Have a nice weekend.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Oct 2026 23:19:20 GMT</pubDate>
    <dc:creator>DB1To3</dc:creator>
    <dc:date>2026-10-16T23:19:20Z</dc:date>
    <item>
      <title>Zerobus Variant Data not Processed as Expected (json data destined for Variant column).</title>
      <link>https://community.databricks.com/t5/data-engineering/zerobus-variant-data-not-processed-as-expected-json-data/m-p/173633#M56736</link>
      <description>&lt;P&gt;Lets say I have a table receiving zerobus data (json) over HTTP/rest.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DB1To3_0-1792159051588.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/32292i8F3C02B32960C31B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DB1To3_0-1792159051588.png" alt="DB1To3_0-1792159051588.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;That last VARIANT is "&lt;STRONG&gt;ValueJson&lt;/STRONG&gt;".&lt;BR /&gt;&lt;BR /&gt;If I want to submit data to it, I would expect to be able to use normal json formatting:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
    {
        "a": "E",
        "b": 123,
        "c": "xyz", 
        "ValueJson": { "x" :  "y" }


    }
]
  &lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Unfortunately it doesn't want that part of the record to be ACTUAL json.&amp;nbsp; The error is like so&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DB1To3_1-1792159180521.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/32293i7333ED2A26AF7AB7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DB1To3_1-1792159180521.png" alt="DB1To3_1-1792159180521.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Record decoder/encoder error: invalid type: map, expected a string at line 13 column 24. Error Code: 4044, Error State: 3.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Unfortunately the fix is to send json-encoded json (escaped json in a string, since the error says it expected a string).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
    {
        "a": "E",
        "b": 123,
        "c": "xyz", 
        "ValueJson": "{ \"x\" :  \"y\" }"


    }
]
  &lt;/LI-CODE&gt;&lt;P&gt;Does this seem reasonable behavior, or is it a bug?&amp;nbsp; I think it is a bit unnatural to have to encode the json VARIANT instead of just nesting it inside the record as normal json.&amp;nbsp; Ideally the use of this VARIANT wouldn't force us towards using json-encoded-json.&amp;nbsp; It isn't the end of the world, but it seems like a very unfortunate way of sending data from a remote client - one that shouldn't need to have a deep understanding of the eccentricities of the VARIANT-parsing rules for zerobus.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2026 14:10:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/zerobus-variant-data-not-processed-as-expected-json-data/m-p/173633#M56736</guid>
      <dc:creator>DB1To3</dc:creator>
      <dc:date>2026-10-16T14:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Zerobus Variant Data not Processed as Expected (json data destined for Variant column).</title>
      <link>https://community.databricks.com/t5/data-engineering/zerobus-variant-data-not-processed-as-expected-json-data/m-p/173635#M56737</link>
      <description>&lt;P&gt;I found docs that say I'm supposed to rely on json-encoded-json:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DB1To3_0-1792159924017.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/32297iD20FF455A0CFBEC4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DB1To3_0-1792159924017.png" alt="DB1To3_0-1792159924017.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/aws/en/ingestion/zerobus-concepts#supported-data-types" target="_blank"&gt;https://docs.databricks.com/aws/en/ingestion/zerobus-concepts#supported-data-types&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;That is pretty unfortunate.&amp;nbsp; I guess it isn't the end of the world, but it gives a dirty feeling when presenting data to a remote system in this way.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2026 14:14:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/zerobus-variant-data-not-processed-as-expected-json-data/m-p/173635#M56737</guid>
      <dc:creator>DB1To3</dc:creator>
      <dc:date>2026-10-16T14:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Zerobus Variant Data not Processed as Expected (json data destined for Variant column).</title>
      <link>https://community.databricks.com/t5/data-engineering/zerobus-variant-data-not-processed-as-expected-json-data/m-p/173667#M56745</link>
      <description>&lt;P&gt;Agree it feels unnatural, but you can hide it from the remote client with a thin encoding step right before sending, so producers keep working with normal nested JSON.&lt;/P&gt;&lt;P&gt;A small helper that encodes only the VARIANT columns:&lt;/P&gt;&lt;P&gt;import json&lt;/P&gt;&lt;P&gt;VARIANT_COLUMNS = {"ValueJson"}&lt;/P&gt;&lt;P&gt;def to_zerobus_record(record: dict) -&amp;gt; dict:&lt;BR /&gt;return {&lt;BR /&gt;k: json.dumps(v) if k in VARIANT_COLUMNS and not isinstance(v, str) else v&lt;BR /&gt;for k, v in record.items()&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;record = {"a": "E", "b": 123, "c": "xyz", "ValueJson": {"x": "y"}}&lt;BR /&gt;payload = [to_zerobus_record(record)]&lt;BR /&gt;# -&amp;gt; [{"a": "E", "b": 123, "c": "xyz", "ValueJson": "{\"x\": \"y\"}"}]&lt;/P&gt;&lt;P&gt;On the Databricks side nothing changes: it lands as a real VARIANT, not a string, so you query it normally:&lt;/P&gt;&lt;P&gt;SELECT&lt;BR /&gt;a,&lt;BR /&gt;ValueJson:x::string AS x,&lt;BR /&gt;variant_get(ValueJson, '$.x', 'string') AS x_alt&lt;BR /&gt;FROM catalog.schema.your_table;&lt;/P&gt;&lt;P&gt;If several producers send data, ship this helper in a small shared client package so nobody needs to know about the rule.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2026 17:44:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/zerobus-variant-data-not-processed-as-expected-json-data/m-p/173667#M56745</guid>
      <dc:creator>Jen_Evangelista</dc:creator>
      <dc:date>2026-10-16T17:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Zerobus Variant Data not Processed as Expected (json data destined for Variant column).</title>
      <link>https://community.databricks.com/t5/data-engineering/zerobus-variant-data-not-processed-as-expected-json-data/m-p/173687#M56749</link>
      <description>&lt;P&gt;Thanks for the tip.&amp;nbsp; Have a nice weekend.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2026 23:19:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/zerobus-variant-data-not-processed-as-expected-json-data/m-p/173687#M56749</guid>
      <dc:creator>DB1To3</dc:creator>
      <dc:date>2026-10-16T23:19:20Z</dc:date>
    </item>
  </channel>
</rss>

