<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Разбор ответа VK API или JSON]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=12701</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=12701&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Разбор ответа VK API или JSON».]]></description>
		<lastBuildDate>Wed, 07 Aug 2019 20:13:42 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=135348#p135348</link>
			<description><![CDATA[<p>Почему ключ &quot;pk&quot; отображается в виде дробного числа? —<br /></p><div class="codebox"><pre><code>ResponseText =
(
{&quot;comment_likes_enabled&quot;: true, &quot;comments&quot;: [{&quot;pk&quot;: 17849713558010739, &quot;user_id&quot;: 198212294, &quot;text&quot;: &quot;Тире ставится, когда есть пробел&quot;, &quot;type&quot;: 0, &quot;created_at&quot;: 1440283999, &quot;created_at_utc&quot;: 1440283999, &quot;content_type&quot;: &quot;comment&quot;, &quot;status&quot;: &quot;Active&quot;, &quot;bit_flags&quot;: 0, &quot;user&quot;: {&quot;pk&quot;: 198212294, &quot;username&quot;: &quot;artijado&quot;, &quot;full_name&quot;: &quot;Igor Malinin&quot;, &quot;is_private&quot;: false, &quot;profile_pic_url&quot;: &quot;https://scontent-arn2-1.cdninstagram.com/vp/cc261c5894efaa68c8e5e7d40c02f103/5DE7C76F/t51.2885-19/s150x150/60960188_330080244351723_7306559494501171200_n.jpg?_nc_ht=scontent-arn2-1.cdninstagram.com&quot;, &quot;profile_pic_id&quot;: &quot;2053930082462014902_198212294&quot;, &quot;is_verified&quot;: false, &quot;latest_reel_media&quot;: 1565204355}, &quot;did_report_as_spam&quot;: false, &quot;share_enabled&quot;: false, &quot;has_liked_comment&quot;: false, &quot;comment_like_count&quot;: 0, &quot;inline_composer_display_condition&quot;: &quot;never&quot;}], &quot;comment_count&quot;: 1, &quot;caption&quot;: {&quot;pk&quot;: 17852726821010739, &quot;user_id&quot;: 1545290738, &quot;text&quot;: &quot;Уточнила написание числовых интервалов в \&quot;Справочнике издателя и автора\&quot; Мильчина и Чельцовой: между цифрами ставится широченное тире (а я ставил минус из скромности, он всё же не так режет глаз своей шириной). Забавно, что при этом на обложке самого справочника красуется дефис.\n\n#книжныйдизайн #emdash #мильчин #издал #artlebedev&quot;, &quot;type&quot;: 1, &quot;created_at&quot;: 1447723802, &quot;created_at_utc&quot;: 1447723802, &quot;content_type&quot;: &quot;comment&quot;, &quot;status&quot;: &quot;Active&quot;, &quot;bit_flags&quot;: 0, &quot;user&quot;: {&quot;pk&quot;: 1545290738, &quot;username&quot;: &quot;addaald&quot;, &quot;full_name&quot;: &quot;Adda Ald&quot;, &quot;is_private&quot;: false, &quot;profile_pic_url&quot;: &quot;https://scontent-arn2-1.cdninstagram.com/vp/5244ed9c2b65d6d8e016149616e58e77/5DC8DF29/t51.2885-19/s150x150/62204076_2392406174113939_623129493279604736_n.jpg?_nc_ht=scontent-arn2-1.cdninstagram.com&quot;, &quot;profile_pic_id&quot;: &quot;2064098053023530828_1545290738&quot;, &quot;is_verified&quot;: false}, &quot;did_report_as_spam&quot;: false, &quot;share_enabled&quot;: false}, &quot;caption_is_edited&quot;: true, &quot;has_more_comments&quot;: false, &quot;has_more_headload_comments&quot;: false, &quot;media_header_display&quot;: &quot;none&quot;, &quot;display_realtime_typing_indicator&quot;: true, &quot;preview_comments&quot;: [], &quot;can_view_more_preview_comments&quot;: false, &quot;status&quot;: &quot;ok&quot;}
)

edges := JSON.Parse(ResponseText).comments
MsgBox % ListValues(edges)
ListValues(edges) {
   list := &quot;&quot;
   For k, NDS1 in edges {
      text :=                    NDS1.text
      created_at :=              NDS1.created_at
      pk :=                      NDS1.pk
      comment_like_count :=      NDS1.comment_like_count
      user_id :=                 NDS1.user_id
      username :=                NDS1.user.username
      full_name :=               NDS1.user.full_name
      profile_pic_id :=          NDS1.user.profile_pic_id
     ;profile_pic_url :=         NDS1.user.profile_pic_url

      list .= created_at &quot; `n&quot; text &quot; `n▌&quot; pk &quot; `n&quot; full_name &quot; `n&quot; username &quot; `n&quot; user_id &quot; `n&quot; profile_pic_id &quot; `n&quot; comment_like_count &quot;`n&quot;

   } Return list
}

class JSON
{
   static JS := JSON._GetJScripObject()
   
   Parse(JsonString)  {
      try oJSON := this.JS.(&quot;(&quot; JsonString &quot;)&quot;)
      catch  {
         MsgBox, Wrong JsonString!
         Return
      }
      Return this._CreateObject(oJSON)
   }

   _GetJScripObject()  {
      VarSetCapacity(tmpFile, (MAX_PATH := 260) &lt;&lt; !!A_IsUnicode, 0)
      DllCall(&quot;GetTempFileName&quot;, Str, A_Temp, Str, &quot;AHK&quot;, UInt, 0, Str, tmpFile)
      
      FileAppend,
      (
      &lt;component&gt;
      &lt;public&gt;&lt;method name=&#039;eval&#039;/&gt;&lt;/public&gt;
      &lt;script language=&#039;JScript&#039;&gt;&lt;/script&gt;
      &lt;/component&gt;
      ), % tmpFile
      
      JS := ObjBindMethod( ComObjGet(&quot;script:&quot; . tmpFile), &quot;eval&quot; )
      FileDelete, % tmpFile
      JSON._AddMethods(JS)
      Return JS
   }

   _AddMethods(ByRef JS)  {
      JScript =
      (
         Object.prototype.GetKeys = function () {
            var keys = []
            for (var k in this)
               if (this.hasOwnProperty(k))
                  keys.push(k)
            return keys
         }
         Object.prototype.IsArray = function () {
            var toStandardString = {}.toString
            return toStandardString.call(this) == &#039;[object Array]&#039;
         }
      )
      JS.(&quot;delete ActiveXObject; delete GetObject;&quot;)
      JS.(JScript)
   }

   _CreateObject(ObjJS)  {
      res := ObjJS.IsArray()
      if (res = &quot;&quot;)
         Return ObjJS
      
      else if (res = -1)  {
         obj := []
         Loop % ObjJS.length
            obj[A_Index] := this._CreateObject(ObjJS[A_Index - 1])
      }
      else if (res = 0)  {
         obj := {}
         keys := ObjJS.GetKeys()
         Loop % keys.length
            k := keys[A_Index - 1], obj[k] := this._CreateObject(ObjJS[k])
      }
      Return obj
   }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Wed, 07 Aug 2019 20:13:42 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=135348#p135348</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132301#p132301</link>
			<description><![CDATA[<p>Мои поздравления! <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Wed, 20 Feb 2019 13:11:19 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132301#p132301</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132300#p132300</link>
			<description><![CDATA[<p>Спасибо, алилуйя) —<br /></p><div class="codebox"><pre><code>edges := JSON.Parse(ResponseText).data.shortcode_media.edge_media_to_parent_comment.edges
MsgBox % ListValues(edges)
ListValues(edges) {
   list := &quot;&quot;
   For k, NDS1 in edges {
      text :=                    NDS1.node.text
      end_cursor :=              NDS1.node.edge_threaded_comments.page_info.end_cursor
      id :=                      NDS1.node.id
      created_at :=              NDS1.node.created_at
      username :=                NDS1.node.owner.username
      profile_pic_url :=         NDS1.node.owner.profile_pic_url
      edge_threaded_comments :=  NDS1.node.edge_threaded_comments.count
      edge_liked_by :=           NDS1.node.edge_liked_by.count
      edges :=                   NDS1.node.edge_threaded_comments.edges

      list .= created_at &quot; | &quot; edge_liked_by &quot; | &quot; edge_threaded_comments
       . &quot; | &quot; end_cursor &quot; | &quot; id &quot; | &quot; profile_pic_url &quot; | &quot; text &quot; | &quot; username &quot;`n&quot;

      For i, NDS2 in NDS1.node.edge_threaded_comments.edges {
         text :=                    NDS2.node.text
         end_cursor :=              NDS2.node.edge_threaded_comments.page_info.end_cursor
         id :=                      NDS2.node.id
         created_at :=              NDS2.node.created_at
         username :=                NDS2.node.owner.username
         profile_pic_url :=         NDS2.node.owner.profile_pic_url
         edge_threaded_comments :=  NDS2.node.edge_threaded_comments.count
         edge_liked_by :=           NDS2.node.edge_liked_by.count

         list .= &quot;`t&quot; created_at &quot; | &quot; edge_liked_by &quot; | &quot; edge_threaded_comments
          . &quot; | &quot; end_cursor &quot; | &quot; id &quot; | &quot; profile_pic_url &quot; | &quot; text &quot; | &quot; username &quot;`n&quot;
      }
   } Return list
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Wed, 20 Feb 2019 12:22:36 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132300#p132300</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132299#p132299</link>
			<description><![CDATA[<p>Что Вас останавливает перед тем, чтобы взять и попробовать? <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Ничего ведь не сломается, даже если результат не подтвердит ожидания.<br />Можно построить дополнительную обработку вложенных &quot;edges&quot;, на основании их количества, например, так, получить все &quot;id&quot;<br /></p><div class="codebox"><pre><code>comments_count := v.node.edge_threaded_comments.count
Loop,% comments_count
	MsgBox % v.node.edge_threaded_comments.edges[ A_Index ].node.id</code></pre></div><p>Или без участия этого счётчика:<br /></p><div class="codebox"><pre><code>For i, comment in v.node.edge_threaded_comments.edges
	MsgBox % comment.node.id</code></pre></div><p>Вместо &quot;id&quot; может быть любое иное имя, которое Вам нужно, или путь, как, например:<br /></p><div class="codebox"><pre><code>For i, comment in v.node.edge_threaded_comments.edges
	MsgBox % comment.node.owner.username</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Wed, 20 Feb 2019 11:28:22 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132299#p132299</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132282#p132282</link>
			<description><![CDATA[<p>Я правильно понял, что если прописать здесь нужную иерархию, предварительно значения будут извлекаться? —<br /></p><div class="codebox"><pre><code>edges :=                   v.node.edge_threaded_comments.edges</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Tue, 19 Feb 2019 23:25:12 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132282#p132282</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132281#p132281</link>
			<description><![CDATA[<p>Об этом и разговор. Подразумевается, что раз программист разрабатывает программу, то не в Виндовом блокноте. Но Ваше:<br /></p><div class="quotebox"><cite>DD пишет:</cite><blockquote><p> ... несколько раз за последние два дня уже безуспешно занимался комбинаторикой</p></blockquote></div><p>Натолкнуло именно на отсутствие нужного инструмента и понимания принципов исследования чужого кода. Хотя последнее, как раз таки чуть ли не ядро, в Вашей системе познания. Всё, что я узнавал когда-либо в программировании, основано на чужих примерах и, думаю, так у всех, или в подавляющем большинстве.</p><div class="quotebox"><cite>DD пишет:</cite><blockquote><p> ... а там последних ключей оказалось достаточно). Вы бы хоть записку оставили).</p></blockquote></div><p>Так бы я затёр все бонусы получаемые в результате Вашего &quot;Brainstorm&quot;, а так, Вы это наверняка теперь запомните. <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p><div class="quotebox"><cite>DD пишет:</cite><blockquote><p>касаемо edge_liked_by/edge_threaded_comments</p></blockquote></div><p>Обратите внимание, что вложенные комментарии имеют схожую структуру, за исключением имён, отвечающих за наличие собственных вложенных &quot;edges&quot;. В примерах выше, для обработки их содержимого функция вызывала сама себя, но Вы может так же описать дополнительную логику, проверяя:<br /></p><div class="codebox"><pre><code>edge_threaded_comments :=  v.node.edge_threaded_comments.count</code></pre></div><p>Которое всегда содержит количество вложенных комментариев.</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Tue, 19 Feb 2019 21:58:33 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132281#p132281</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132280#p132280</link>
			<description><![CDATA[<p>Тоже пользовался Notepad++, но с разворотом конечно лучше).</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Tue, 19 Feb 2019 20:59:25 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132280#p132280</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132279#p132279</link>
			<description><![CDATA[<p>Так ведь я более-менее полную иерархию пытался прописывать, а там последних ключей оказалось достаточно). Вы бы хоть записку оставили). Но это касаемо edge_liked_by/edge_threaded_comments. А под-коменты по логике как-то так должны выводиться, но это не срабатывает —<br /></p><div class="codebox"><pre><code>
      edges :=                   v.node.edge_threaded_comments.edges.node
      edges :=                   v.node.edge_threaded_comments.edges
</code></pre></div><p>Целиком:<br /></p><div class="codebox"><pre><code>
ResponseText = {&quot;data&quot;:{&quot;shortcode_media&quot;:{&quot;edge_media_to_parent_comment&quot;:{&quot;count&quot;:224,&quot;page_info&quot;:{&quot;has_next_page&quot;:true,&quot;end_cursor&quot;:&quot;{\&quot;cached_comments_cursor\&quot;: \&quot;17988603055194856\&quot;, \&quot;bifilter_token\&quot;: \&quot;KC0BDABAABgAEAAQAAgACAB799_Lz77P7011eOpvf_W__wAUAAAAABAEQ0EgwBAA\&quot;}&quot;},&quot;edges&quot;:[{&quot;node&quot;:{&quot;id&quot;:&quot;18033126139045251&quot;,&quot;text&quot;:&quot;cmt1&quot;,&quot;created_at&quot;:1549564430,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;7147681468&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic1&quot;,&quot;username&quot;:&quot;uname1&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:3},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;18035179396030512&quot;,&quot;text&quot;:&quot;cmt2&quot;,&quot;created_at&quot;:1549564345,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;9037884033&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic2&quot;,&quot;username&quot;:&quot;uname2&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;17864531659321218&quot;,&quot;text&quot;:&quot;cmt3&quot;,&quot;created_at&quot;:1549563973,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;3881253436&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic3&quot;,&quot;username&quot;:&quot;uname3&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:1},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:3,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[{&quot;node&quot;:{&quot;id&quot;:&quot;18031519045002885&quot;,&quot;text&quot;:&quot;cmt4&quot;,&quot;created_at&quot;:1549565442,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;1514648096&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic4&quot;,&quot;username&quot;:&quot;uname4&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:3}}},{&quot;node&quot;:{&quot;id&quot;:&quot;18014501047114258&quot;,&quot;text&quot;:&quot;cmt5&quot;,&quot;created_at&quot;:1549622948,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;3881253436&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic5&quot;,&quot;username&quot;:&quot;uname5&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0}}},{&quot;node&quot;:{&quot;id&quot;:&quot;18012364975121513&quot;,&quot;text&quot;:&quot;cmt6&quot;,&quot;created_at&quot;:1549624991,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;1514648096&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic6&quot;,&quot;username&quot;:&quot;uname6&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:1}}}]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;18014605018119580&quot;,&quot;text&quot;:&quot;cmt7&quot;,&quot;created_at&quot;:1549563882,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;1575737610&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic7&quot;,&quot;username&quot;:&quot;uname7&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;18006807262092548&quot;,&quot;text&quot;:&quot;cmt8&quot;,&quot;created_at&quot;:1549563710,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;3451206464&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic8&quot;,&quot;username&quot;:&quot;uname8&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;18014414656112658&quot;,&quot;text&quot;:&quot;cmt9&quot;,&quot;created_at&quot;:1549563555,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;3451206464&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic9&quot;,&quot;username&quot;:&quot;uname9&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;17899732756291214&quot;,&quot;text&quot;:&quot;cmt10&quot;,&quot;created_at&quot;:1549563119,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;2330649029&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic10&quot;,&quot;username&quot;:&quot;uname10&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;18030447571010198&quot;,&quot;text&quot;:&quot;cmt11&quot;,&quot;created_at&quot;:1549562991,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;5763461995&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic11&quot;,&quot;username&quot;:&quot;uname11&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;18016886404100187&quot;,&quot;text&quot;:&quot;cmt12&quot;,&quot;created_at&quot;:1549562982,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;321345545&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic12&quot;,&quot;username&quot;:&quot;uname12&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;17992787185168932&quot;,&quot;text&quot;:&quot;cmt13&quot;,&quot;created_at&quot;:1549562672,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;3267878847&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic13&quot;,&quot;username&quot;:&quot;uname13&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;18014099035112644&quot;,&quot;text&quot;:&quot;cmt14&quot;,&quot;created_at&quot;:1549562649,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;7495332966&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic14&quot;,&quot;username&quot;:&quot;uname14&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}},{&quot;node&quot;:{&quot;id&quot;:&quot;17851892326346682&quot;,&quot;text&quot;:&quot;cmt15&quot;,&quot;created_at&quot;:1549562460,&quot;did_report_as_spam&quot;:false,&quot;owner&quot;:{&quot;id&quot;:&quot;8692656309&quot;,&quot;is_verified&quot;:false,&quot;profile_pic_url&quot;:&quot;pic15&quot;,&quot;username&quot;:&quot;uname15&quot;},&quot;viewer_has_liked&quot;:false,&quot;edge_liked_by&quot;:{&quot;count&quot;:0},&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}}}]}}},&quot;status&quot;:&quot;ok&quot;}

edges := JSON.Parse(ResponseText).data.shortcode_media.edge_media_to_parent_comment.edges
MsgBox % ListValues(edges)
ListValues(edges) {
   list := &quot;&quot;
   For k, v in edges {
      text :=                    v.node.text
      end_cursor :=              v.node.edge_threaded_comments.page_info.end_cursor
      id :=                      v.node.id
      created_at :=              v.node.created_at
      username :=                v.node.owner.username
      profile_pic_url :=         v.node.owner.profile_pic_url
      edge_threaded_comments :=  v.node.edge_threaded_comments.count
      edge_liked_by :=           v.node.edge_liked_by.count
      edges :=                   v.node.edge_threaded_comments.edges.node
      ; ...
      list .= created_at &quot; | &quot; edge_liked_by &quot; | &quot; edge_threaded_comments &quot; | &quot; end_cursor &quot; | &quot; id &quot; | &quot; profile_pic_url &quot; | &quot; text &quot; | &quot; username &quot; | &quot; edges
   } Return list
}

class JSON
{
   static JS := JSON._GetJScripObject()
   
   Parse(JsonString)  {
      try oJSON := this.JS.(&quot;(&quot; JsonString &quot;)&quot;)
      catch  {
         MsgBox, Wrong JsonString!
         Return
      }
      Return this._CreateObject(oJSON)
   }

   _GetJScripObject()  {
      VarSetCapacity(tmpFile, (MAX_PATH := 260) &lt;&lt; !!A_IsUnicode, 0)
      DllCall(&quot;GetTempFileName&quot;, Str, A_Temp, Str, &quot;AHK&quot;, UInt, 0, Str, tmpFile)
      
      FileAppend,
      (
      &lt;component&gt;
      &lt;public&gt;&lt;method name=&#039;eval&#039;/&gt;&lt;/public&gt;
      &lt;script language=&#039;JScript&#039;&gt;&lt;/script&gt;
      &lt;/component&gt;
      ), % tmpFile
      
      JS := ObjBindMethod( ComObjGet(&quot;script:&quot; . tmpFile), &quot;eval&quot; )
      FileDelete, % tmpFile
      JSON._AddMethods(JS)
      Return JS
   }

   _AddMethods(ByRef JS)  {
      JScript =
      (
         Object.prototype.GetKeys = function () {
            var keys = []
            for (var k in this)
               if (this.hasOwnProperty(k))
                  keys.push(k)
            return keys
         }
         Object.prototype.IsArray = function () {
            var toStandardString = {}.toString
            return toStandardString.call(this) == &#039;[object Array]&#039;
         }
      )
      JS.(&quot;delete ActiveXObject; delete GetObject;&quot;)
      JS.(JScript)
   }

   _CreateObject(ObjJS)  {
      res := ObjJS.IsArray()
      if (res = &quot;&quot;)
         Return ObjJS
      
      else if (res = -1)  {
         obj := []
         Loop % ObjJS.length
            obj[A_Index] := this._CreateObject(ObjJS[A_Index - 1])
      }
      else if (res = 0)  {
         obj := {}
         keys := ObjJS.GetKeys()
         Loop % keys.length
            k := keys[A_Index - 1], obj[k] := this._CreateObject(ObjJS[k])
      }
      Return obj
   }
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Tue, 19 Feb 2019 20:58:21 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132279#p132279</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132278#p132278</link>
			<description><![CDATA[<p>Благодарю!<br />То, что нужно.</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Tue, 19 Feb 2019 20:18:08 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132278#p132278</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132277#p132277</link>
			<description><![CDATA[<p>Есть куча онлайн сервисов, например этот:<br /><a href="https://jsonformatter.org/json-viewer">https://jsonformatter.org/json-viewer</a></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 19 Feb 2019 19:56:46 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132277#p132277</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132276#p132276</link>
			<description><![CDATA[<p>Если сохранить JSON в файл с расширением .json, то Firefox открывает его в виде дерева без всяких плагинов:<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p><span class="postimg"><img src="https://i.imgur.com/cYlCHtb.png" alt="https://i.imgur.com/cYlCHtb.png" /></span></p></div></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 19 Feb 2019 19:26:24 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132276#p132276</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132275#p132275</link>
			<description><![CDATA[<p>Пользуетесь редактором с подсветкой? Если да, то наверняка он должен так же подсвечивать пару для выделенной скобки.<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p><span class="postimg"><img src="https://b.radikal.ru/b13/1902/79/162dc7f43dff.gif" alt="https://b.radikal.ru/b13/1902/79/162dc7f43dff.gif" /></span></p></div></div><p>Таким образом можно выделить весь интересующий участок JSON-строки для анализа. Находите начало интересующего Вас блока, выделяете его весь вместе со скобками, которые его обозначают, копируете в отдельное место. Получается, например, так:<br /></p><div class="codebox"><pre><code>&quot;edge_threaded_comments&quot;:{&quot;count&quot;:0,&quot;page_info&quot;:{&quot;has_next_page&quot;:false,&quot;end_cursor&quot;:null},&quot;edges&quot;:[]}</code></pre></div><p>Если это ещё не помогает понять структуру внутри, например, потому, что участок кода может быть большим, разбираете его для удобочитаемости, пользуясь самыми обычными отступами и переносом строки:<br /></p><div class="codebox"><pre><code>&quot;edge_threaded_comments&quot;:
	{
		&quot;count&quot;:0,
		&quot;page_info&quot;:
			{
				&quot;has_next_page&quot;:false,
				&quot;end_cursor&quot;:null
			},
		&quot;edges&quot;:[]
	}
</code></pre></div><p>Так, можно визуализировать любую иерархию. Поищите в гугле, плагины для браузера(наверняка есть), в который можно поместить такой JSON и он его представит в виде раскрывающегося дерева, на подобии эксплорера. Возможно есть ещё какие-либо аналоги. На дворе 2к19, было бы странно, если бы повсеместно используемый компонент не обзавёлся чем-то подобным.</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Tue, 19 Feb 2019 19:16:50 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132275#p132275</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132274#p132274</link>
			<description><![CDATA[<p>Так я и говорю вторую страницу, что хочу получать: значения &quot;edge_liked_by.count&quot;, а также — для последнего скрипта — под-комментарии (то, что выше в скриптах отбивалось табуляцией от основных комментариев). Не могли бы Вы подсказать правильную последовательность иерархии, потому что я несколько раз за последние два дня уже безуспешно занимался комбинаторикой?</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Tue, 19 Feb 2019 17:18:35 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132274#p132274</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132273#p132273</link>
			<description><![CDATA[<p>Я не могу этого знать. Цель получить что-то ставите перед собой Вы, значит и знать, что получать, должны Вы.<br />На каждой итерации, Вам доступен весь контент текущего элемента, массива &quot;edges&quot;. Всё что нужно для получения значения из конкретного поля в этом элементе - полностью квалифицированное имя этого поля, относительно элемента. В нашем случае, относительно &quot;v.node&quot;:<br /></p><div class="codebox"><pre><code>end_cursor :=	v.node.edge_threaded_comments.page_info.end_cursor
text :=			v.node.text
; ...</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Tue, 19 Feb 2019 16:56:24 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132273#p132273</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разбор ответа VK API или JSON]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=132272#p132272</link>
			<description><![CDATA[<p>Да, имелась в виду иерархия через точку (включая &quot;count&quot;) для вывода &quot;edge_liked_by&quot; и под-комментариев. Достаточно указать в этом скрипте такую валидную иерархию через точку, или надо еще что-то &quot;на каждой итерации выбирать&quot;, &quot;сохраняя в промежуточных переменных искомые значения&quot; и т. д.?</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Tue, 19 Feb 2019 16:32:45 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=132272#p132272</guid>
		</item>
	</channel>
</rss>
