<?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: Issue while extracting value From Decimal Key is Json in Warehousing &amp; Analytics</title>
    <link>https://community.databricks.com/t5/warehousing-analytics/issue-while-extracting-value-from-decimal-key-is-json/m-p/70823#M1351</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/86310"&gt;@data_guy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I've performed a reproduction of your scenario and could successfully select all data. Please check screenshot below:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raphaelblg_1-1716847137901.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/7899i7FE69B7022958630/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raphaelblg_1-1716847137901.png" alt="raphaelblg_1-1716847137901.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;This is the source code:&lt;/DIV&gt;
&lt;DIV&gt;&lt;LI-CODE lang="python"&gt;import json

data_values = { 
               "5.0": { "a": "15.92", "b": 0.0, "c": "15.92", "d": "637.14" }, 
               "0.0": { "a": "15.92", "b": 0.0, "c": "15.92", "d": "637.14" } 
}

json_str = json.dumps(data_values)
dbutils.fs.put("dbfs:/tmp/data_temp.txt", json_str, True)

df = spark.read.json("dbfs:/tmp/data_temp.txt")
df.createOrReplaceTempView("JSON_TEST")

spark.sql("""
SELECT 
    `5.0`.a,
    `5.0`.b,
    `5.0`.c,
    `0.0`.a,
    `0.0`.b,
    `0.0`.c
FROM JSON_TEST
"""
).display()&lt;/LI-CODE&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 27 May 2024 21:59:38 GMT</pubDate>
    <dc:creator>raphaelblg</dc:creator>
    <dc:date>2024-05-27T21:59:38Z</dc:date>
    <item>
      <title>Issue while extracting value From Decimal Key is Json</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/issue-while-extracting-value-from-decimal-key-is-json/m-p/39661#M847</link>
      <description>&lt;P&gt;Hi Guys,&lt;BR /&gt;&lt;BR /&gt;I have a JSON as the below structure where the key is as decimal.&lt;BR /&gt;{ "5.0": { "a": "15.92", "b": 0.0, "c": "15.92", "d": "637.14" }, "0.0": { "a": "15.92", "b": 0.0, "c": "15.92", "d": "637.14" } }&lt;BR /&gt;&lt;STRONG&gt;schema_of_json&lt;/STRONG&gt; returns the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;STRUCT&amp;lt;`0.0`: STRUCT&amp;lt;a: STRING, b: DOUBLE, c: STRING, d: STRING&amp;gt;, `5.0`: STRUCT&amp;lt;a: STRING, b: DOUBLE, c: STRING, d: STRING&amp;gt;&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;I am facing an issue in extracting values against (a,b,c,d) for 5.0 and 0.0 in Databricks SQL. Following are the methods that I have tried, but still not able to extract value as it is coming NULL.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT 
data,
data:`5.0` as method1,
get_json_object(data, '$.`5.0`') as method2
FROM staging.consumables.test;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you guys please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 14:23:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/issue-while-extracting-value-from-decimal-key-is-json/m-p/39661#M847</guid>
      <dc:creator>data_guy</dc:creator>
      <dc:date>2023-08-11T14:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while extracting value From Decimal Key is Json</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/issue-while-extracting-value-from-decimal-key-is-json/m-p/70823#M1351</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/86310"&gt;@data_guy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I've performed a reproduction of your scenario and could successfully select all data. Please check screenshot below:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raphaelblg_1-1716847137901.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/7899i7FE69B7022958630/image-size/medium?v=v2&amp;amp;px=400" role="button" title="raphaelblg_1-1716847137901.png" alt="raphaelblg_1-1716847137901.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;This is the source code:&lt;/DIV&gt;
&lt;DIV&gt;&lt;LI-CODE lang="python"&gt;import json

data_values = { 
               "5.0": { "a": "15.92", "b": 0.0, "c": "15.92", "d": "637.14" }, 
               "0.0": { "a": "15.92", "b": 0.0, "c": "15.92", "d": "637.14" } 
}

json_str = json.dumps(data_values)
dbutils.fs.put("dbfs:/tmp/data_temp.txt", json_str, True)

df = spark.read.json("dbfs:/tmp/data_temp.txt")
df.createOrReplaceTempView("JSON_TEST")

spark.sql("""
SELECT 
    `5.0`.a,
    `5.0`.b,
    `5.0`.c,
    `0.0`.a,
    `0.0`.b,
    `0.0`.c
FROM JSON_TEST
"""
).display()&lt;/LI-CODE&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 27 May 2024 21:59:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/issue-while-extracting-value-from-decimal-key-is-json/m-p/70823#M1351</guid>
      <dc:creator>raphaelblg</dc:creator>
      <dc:date>2024-05-27T21:59:38Z</dc:date>
    </item>
  </channel>
</rss>

