ResponseText =
(
{"comment_likes_enabled": true, "comments": [{"pk": 17849713558010739, "user_id": 198212294, "text": "Тире ставится, когда есть пробел", "type": 0, "created_at": 1440283999, "created_at_utc": 1440283999, "content_type": "comment", "status": "Active", "bit_flags": 0, "user": {"pk": 198212294, "username": "artijado", "full_name": "Igor Malinin", "is_private": false, "profile_pic_url": "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", "profile_pic_id": "2053930082462014902_198212294", "is_verified": false, "latest_reel_media": 1565204355}, "did_report_as_spam": false, "share_enabled": false, "has_liked_comment": false, "comment_like_count": 0, "inline_composer_display_condition": "never"}], "comment_count": 1, "caption": {"pk": 17852726821010739, "user_id": 1545290738, "text": "Уточнила написание числовых интервалов в \"Справочнике издателя и автора\" Мильчина и Чельцовой: между цифрами ставится широченное тире (а я ставил минус из скромности, он всё же не так режет глаз своей шириной). Забавно, что при этом на обложке самого справочника красуется дефис.\n\n#книжныйдизайн #emdash #мильчин #издал #artlebedev", "type": 1, "created_at": 1447723802, "created_at_utc": 1447723802, "content_type": "comment", "status": "Active", "bit_flags": 0, "user": {"pk": 1545290738, "username": "addaald", "full_name": "Adda Ald", "is_private": false, "profile_pic_url": "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", "profile_pic_id": "2064098053023530828_1545290738", "is_verified": false}, "did_report_as_spam": false, "share_enabled": false}, "caption_is_edited": true, "has_more_comments": false, "has_more_headload_comments": false, "media_header_display": "none", "display_realtime_typing_indicator": true, "preview_comments": [], "can_view_more_preview_comments": false, "status": "ok"}
)
edges := JSON.Parse(ResponseText).comments
MsgBox % ListValues(edges)
ListValues(edges) {
list := ""
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 " `n" text " `n▌" pk " `n" full_name " `n" username " `n" user_id " `n" profile_pic_id " `n" comment_like_count "`n"
} Return list
}
class JSON
{
static JS := JSON._GetJScripObject()
Parse(JsonString) {
try oJSON := this.JS.("(" JsonString ")")
catch {
MsgBox, Wrong JsonString!
Return
}
Return this._CreateObject(oJSON)
}
_GetJScripObject() {
VarSetCapacity(tmpFile, (MAX_PATH := 260) << !!A_IsUnicode, 0)
DllCall("GetTempFileName", Str, A_Temp, Str, "AHK", UInt, 0, Str, tmpFile)
FileAppend,
(
<component>
<public><method name='eval'/></public>
<script language='JScript'></script>
</component>
), % tmpFile
JS := ObjBindMethod( ComObjGet("script:" . tmpFile), "eval" )
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) == '[object Array]'
}
)
JS.("delete ActiveXObject; delete GetObject;")
JS.(JScript)
}
_CreateObject(ObjJS) {
res := ObjJS.IsArray()
if (res = "")
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
}
}