<?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: Parse JSON Iin SAS dynamically using keynodes and values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/549114#M152328</link>
    <description>if you use sas9.4 m4 or above, you can simply use json libname for your question</description>
    <pubDate>Sun, 07 Apr 2019 13:49:12 GMT</pubDate>
    <dc:creator>fanfanpao</dc:creator>
    <dc:date>2019-04-07T13:49:12Z</dc:date>
    <item>
      <title>Parse JSON Iin SAS dynamically using keynodes and values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/548498#M152100</link>
      <description>&lt;P&gt;I have this JSOn string&lt;/P&gt;&lt;P&gt;@json='{"name":"John","surname":"Doe","age":45,"skills":["SQL","C#","MVC"]}';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I would like to create a programin sas that is going to dynamically loop through all the nodes and their values and create me a final table with 2 columns:&lt;/P&gt;&lt;P&gt;column 1: all the key nodes of the JSON object&lt;/P&gt;&lt;P&gt;column2: all the values corresponding to those nodes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;desired output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;keynode&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value&lt;/P&gt;&lt;P&gt;-----------------------------&lt;/P&gt;&lt;P&gt;name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;John&lt;/P&gt;&lt;P&gt;Surname&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Doe&lt;/P&gt;&lt;P&gt;Age&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 45&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 14:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/548498#M152100</guid>
      <dc:creator>Sepideh_B</dc:creator>
      <dc:date>2019-04-04T14:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: Parse JSON Iin SAS dynamically using keynodes and values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/548774#M152225</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
x="@json='"||'{"name":"John","surname":"Doe","age":45,"skills":["SQL","C#","MVC"]}'||"'";
run;
data want;
 set x;
 n+1;
 temp=translate(scan(x,-1,"'{}"),'""','[]');
 do i=1 to countw(temp,',','q')	;
   t=scan(temp,i,',','q');
   node=dequote(scan(t,1,':'));
   value=scan(t,2,':');
   output;
 end;
 drop i x t temp;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Apr 2019 14:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/548774#M152225</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-04-05T14:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Parse JSON Iin SAS dynamically using keynodes and values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/548952#M152270</link>
      <description>&lt;P&gt;This is great! Thanks so much!!&lt;/P&gt;&lt;P&gt;if I have a columnin an existing table in SAS that contains JSON strings, is there a way that i can iterate through the columns of that table and parse them like this?&lt;/P&gt;&lt;P&gt;so instead of 1 JSON string, lets say I have 20 and i wanna parse them each and place in the second table. How can i build a&amp;nbsp; do loop on top of the existing do - loop?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 20:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/548952#M152270</guid>
      <dc:creator>Sepideh_B</dc:creator>
      <dc:date>2019-04-05T20:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Parse JSON Iin SAS dynamically using keynodes and values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/549031#M152293</link>
      <description>&lt;P&gt;If there is only one column, replace table name and column name is enough.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; want&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
 &lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; x&lt;SPAN class="token punctuation"&gt;; /*&amp;lt;-- replace table name  and replace variable name X */&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 06 Apr 2019 11:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/549031#M152293</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-04-06T11:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Parse JSON Iin SAS dynamically using keynodes and values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/549114#M152328</link>
      <description>if you use sas9.4 m4 or above, you can simply use json libname for your question</description>
      <pubDate>Sun, 07 Apr 2019 13:49:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-JSON-Iin-SAS-dynamically-using-keynodes-and-values/m-p/549114#M152328</guid>
      <dc:creator>fanfanpao</dc:creator>
      <dc:date>2019-04-07T13:49:12Z</dc:date>
    </item>
  </channel>
</rss>

