<?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: sql JSON_VALUE query and spaces in fields in JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/sql-JSON-VALUE-query-and-spaces-in-fields-in-JSL/m-p/753931#M93597</link>
    <description>&lt;P&gt;Thank you , Jarmo!&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2024 15:36:22 GMT</pubDate>
    <dc:creator>SampleTapir814</dc:creator>
    <dc:date>2024-05-13T15:36:22Z</dc:date>
    <item>
      <title>sql JSON_VALUE query and spaces in fields in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/sql-JSON-VALUE-query-and-spaces-in-fields-in-JSL/m-p/753038#M93484</link>
      <description>&lt;P&gt;I'm trying to query a table in an Oracle table with a field that is JSON. I am using the JSON_VALUE function in the sql. Some of the JSON fields contain spaces so I put double quotes around values and this works when running the query outside of JSL but throws an error running the query as shown below in jsl.&amp;nbsp; Thanks in advance for any hep you can provide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JSL:&lt;/P&gt;&lt;P&gt;dbc = create database connection("Driver={Oracle in InstantClient11_1};UID=xxxx;DBQ=yyyy;PWD=zzzz;");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;user_sql ="select json_value(feature, '$."ball dimension"') as ball_dimension from blah";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;user_dt = execute sql(dbc, user_sql);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 21:27:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/sql-JSON-VALUE-query-and-spaces-in-fields-in-JSL/m-p/753038#M93484</guid>
      <dc:creator>SampleTapir814</dc:creator>
      <dc:date>2024-05-08T21:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: sql JSON_VALUE query and spaces in fields in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/sql-JSON-VALUE-query-and-spaces-in-fields-in-JSL/m-p/753095#M93492</link>
      <description>&lt;P&gt;You have to escape those quotes and usually these methods work (I would use option 1)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

// user_sql ="select json_value(feature, '$."ball dimension"') as ball_dimension from blah";

// Option 1
user_sql1 = "\[select json_value(feature, '$."ball dimension"') as ball_dimension from blah]\";

// Option 2
user_sql2 = "select json_value(feature, '$.\!"ball dimension\!"') as ball_dimension from blah";


// Print demo
Write("\!N" || user_sql1);
Write("\!N" || user_sql2);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/jsl-syntax-rules.shtml" target="_blank" rel="noopener"&gt;https://www.jmp.com/support/help/en/18.0/#page/jmp/jsl-syntax-rules.shtml&lt;/A&gt; - Look for Double Quotes&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1715231918902.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64040i2AABBAAD224098A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1715231918902.png" alt="jthi_0-1715231918902.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;Just to add extra some explanation. If you want have double quotes in your string in JMP, you have to escape them (there are also other characters which must be escaped). You can escape single double quote by replacing it with \!" and if you wish to "auto-escape" everything in your string, wrap it with "\[...]\" instead of just "...".&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 05:49:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/sql-JSON-VALUE-query-and-spaces-in-fields-in-JSL/m-p/753095#M93492</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-09T05:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: sql JSON_VALUE query and spaces in fields in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/sql-JSON-VALUE-query-and-spaces-in-fields-in-JSL/m-p/753931#M93597</link>
      <description>&lt;P&gt;Thank you , Jarmo!&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 15:36:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/sql-JSON-VALUE-query-and-spaces-in-fields-in-JSL/m-p/753931#M93597</guid>
      <dc:creator>SampleTapir814</dc:creator>
      <dc:date>2024-05-13T15:36:22Z</dc:date>
    </item>
  </channel>
</rss>

