<?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: JSON map with forward slash in values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676493#M203992</link>
    <description>&lt;P&gt;Ask SAS support for help.&lt;/P&gt;
&lt;P&gt;It is definitely valid to have / in key value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.w3schools.com/js/js_json_objects.asp#:~:text=Keys%20must%20be%20strings%2C%20and,is%20separated%20by%20a%20comma." target="_blank"&gt;https://www.w3schools.com/js/js_json_objects.asp#:~:text=Keys%20must%20be%20strings%2C%20and,is%20separated%20by%20a%20comma.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can try it yourself:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="https://www.w3schools.com/js/tryit.asp?filename=tryjson_object_loop" target="_blank"&gt;https://www.w3schools.com/js/tryit.asp?filename=tryjson_object_loop&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure where to look for what is valid in that path syntax that the map files are using.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Aug 2020 14:12:21 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-08-13T14:12:21Z</dc:date>
    <item>
      <title>JSON map with forward slash in values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676208#M203860</link>
      <description>&lt;P&gt;I have JSON where the values have a forward slash in them such as "&lt;CODE&gt;Amt w/total&lt;/CODE&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="xisDoc-codeFragment"&gt;&lt;CODE&gt;{
   "data" : [
     { "a" : 1 , "Amt w/total" : 10 },
    ]
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So when the map is created it looks like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="xisDoc-codeFragment"&gt;&lt;CODE&gt;{
    "NAME": "Amt_w_total",
    "TYPE": "NUMERIC",
    "PATH": "/root/data/Amt w/total"
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This reads in as all missing because I assume it's treating the / as a separator in the path and looking for values of "&lt;CODE&gt;Amt w&lt;/CODE&gt;" and "&lt;CODE&gt;total&lt;/CODE&gt;".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to tell it the slash is part of the value?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 15:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676208#M203860</guid>
      <dc:creator>John2020</dc:creator>
      <dc:date>2020-08-12T15:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: JSON map with forward slash in values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676365#M203924</link>
      <description>&lt;P&gt;Just a long shot:&lt;/P&gt;
&lt;P&gt;Maybe SAS expects the / to be escaped, as in&amp;nbsp;&lt;/P&gt;
&lt;PRE class="xisDoc-codeFragment"&gt;&lt;CODE&gt; Amt w\/total&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and gets confused?&lt;/P&gt;
&lt;P&gt;Does the map work if you correct the map?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 02:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676365#M203924</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-08-13T02:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: JSON map with forward slash in values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676490#M203991</link>
      <description>Doesn't seem to. I've tried backlashes, doubling up the slashes, and adding single quotes. If the values can be escaped, I haven't figured out the magic character yet.</description>
      <pubDate>Thu, 13 Aug 2020 13:55:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676490#M203991</guid>
      <dc:creator>John2020</dc:creator>
      <dc:date>2020-08-13T13:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: JSON map with forward slash in values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676493#M203992</link>
      <description>&lt;P&gt;Ask SAS support for help.&lt;/P&gt;
&lt;P&gt;It is definitely valid to have / in key value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.w3schools.com/js/js_json_objects.asp#:~:text=Keys%20must%20be%20strings%2C%20and,is%20separated%20by%20a%20comma." target="_blank"&gt;https://www.w3schools.com/js/js_json_objects.asp#:~:text=Keys%20must%20be%20strings%2C%20and,is%20separated%20by%20a%20comma.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can try it yourself:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="https://www.w3schools.com/js/tryit.asp?filename=tryjson_object_loop" target="_blank"&gt;https://www.w3schools.com/js/tryit.asp?filename=tryjson_object_loop&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure where to look for what is valid in that path syntax that the map files are using.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 14:12:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676493#M203992</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-13T14:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: JSON map with forward slash in values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676498#M203994</link>
      <description>&lt;P&gt;If you cannot get it to work then perhaps your can made a modified version of the data that changes that value.&amp;nbsp; Perhaps using unix tool like sed or even just reading the file in a datastep and using TRANWRD().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename json temp;
options parmcards=json;
parcards4;
{
   "data" : [
     { "a" : 1 , "Amt w/total" : 10 }
    ]
}
;;;;

filename fixed temp;
data _null_;
  infile json;
  file fixed;
  input;
  _infile_=tranwrd(_infile_,'"Amt w/total"','"Amt w_total"');
run;

filename map temp;
libname json json map=map automap=reuse;

proc print data=json.data; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;       ordinal_    ordinal_         Amt_w_
Obs      root        data      a     total

 1         1           1       1      10
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 14:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-map-with-forward-slash-in-values/m-p/676498#M203994</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-13T14:29:01Z</dc:date>
    </item>
  </channel>
</rss>

