<?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: Handling emojis in JSON in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Handling-emojis-in-JSON/m-p/683589#M207079</link>
    <description>&lt;P&gt;Hi bart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; to &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;. Yes jsondata is the content of the file (a bit unclear).&lt;/P&gt;&lt;P&gt;I'm on 9.4m5. Possible fix ther....but could encoding be an issue? I'm using wlatin1.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Sep 2020 09:12:22 GMT</pubDate>
    <dc:creator>sindrew</dc:creator>
    <dc:date>2020-09-14T09:12:22Z</dc:date>
    <item>
      <title>Handling emojis in JSON</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-emojis-in-JSON/m-p/683586#M207077</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to convert json from a rest api to a dataset. In the JSON data there is an emoji, which SAS, or the proc json routine is unable to handle. I've played with idea of getting the data with python (don't know why), but not sure if python will handle this better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example code:&lt;/P&gt;&lt;PRE&gt;filename input   "testjson.json";
%let jsondata = '{"num_records": 1, "data": [[1, "texttexttext \ud83d\udc4d\ud83c\udffb"]], "data_type": "json"}';

libname posts json fileref=input;
proc datasets lib=posts ; quit;

&lt;/PRE&gt;&lt;P&gt;The data array includes more attributes, but libname statement fails on the 4 encoded values at the end of the provided example and program throws the following error. The field is provided by users so there may be more...&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: Invalid JSON in input near line 1 column 71: Some code points did not transcode.
ERROR: Error in the LIBNAME statement.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is it possible to handle this in some way besides getting the developer to change their API (probably not feasible)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 08:16:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-emojis-in-JSON/m-p/683586#M207077</guid>
      <dc:creator>sindrew</dc:creator>
      <dc:date>2020-09-14T08:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Handling emojis in JSON</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-emojis-in-JSON/m-p/683588#M207078</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;
&lt;P&gt;is the `jsondata` the content of the file?&lt;/P&gt;
&lt;P&gt;I executed the following code on sas 9.4m6 (running with ENCODING=UTF8), to put the data into the text file:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename input "testjson.json";

data _null_;
file input;
put '{"num_records": 1, "data": [[1, "texttexttext \ud83d\udc4d\ud83c\udffb texttext"]], "data_type": "json"}';
run;

libname posts json fileref=input;
proc datasets lib=posts ; quit;

proc print data = posts.alldata;
run;

proc print data = posts.data;
run;

proc print data = posts.root;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and everything seems to be ok, log was clear and in the proc print I saw&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; icon (thumbs up)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the best&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 16:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-emojis-in-JSON/m-p/683588#M207078</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-06-23T16:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Handling emojis in JSON</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-emojis-in-JSON/m-p/683589#M207079</link>
      <description>&lt;P&gt;Hi bart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; to &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;. Yes jsondata is the content of the file (a bit unclear).&lt;/P&gt;&lt;P&gt;I'm on 9.4m5. Possible fix ther....but could encoding be an issue? I'm using wlatin1.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 09:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-emojis-in-JSON/m-p/683589#M207079</guid>
      <dc:creator>sindrew</dc:creator>
      <dc:date>2020-09-14T09:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Handling emojis in JSON</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Handling-emojis-in-JSON/m-p/683590#M207080</link>
      <description>&lt;P&gt;My first approach would be to run UTF-8 sSAS session for utf-8 data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 09:15:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Handling-emojis-in-JSON/m-p/683590#M207080</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-09-14T09:15:31Z</dc:date>
    </item>
  </channel>
</rss>

