Can someone help me WTF is going on here?
I'm trying to use Sakuya's JSON plugin to pull movie data from a JSON-encoded string (which is being retrieved via private API-Key from https://www.themoviedb.org)
I thought JSON.Decode was supposed to decode the entire JSON-encoded string into table? Right?
But when I run the following code:
... all I get are the first 3 elements from the string.
This is what it returns:
Huh? How the heck do I actually get the essential info from the encoded-string? Like movie-title, plot, poster-url, etc? I thought that was the whole point? Or am I misunderstanding the purpose of this plugin altogether?
Nb. (Apz and JSON Plugin attached for reference)
I'm trying to use Sakuya's JSON plugin to pull movie data from a JSON-encoded string (which is being retrieved via private API-Key from https://www.themoviedb.org)
I thought JSON.Decode was supposed to decode the entire JSON-encoded string into table? Right?
But when I run the following code:
Code:
[I][COLOR=#008000]-- Nb. sReturn variable contains JSON-encoded string being returned from https://www.themoviedb.org via private API key.[/COLOR][/I] sReturn = [[{"page":1,"total_results":2,"total_pages":1,"results":[{"vote_count":3557,"id":75780,"video":false,"vote_average":6.4,"title":"Jack Reacher","popularity":19.129319,"poster_path":"\/38bmEXmuJuInLs9dwfgOGCHmZ7l.jpg","original_language":"en","original_title":"Jack Reacher","genre_ids":[80,18,53],"backdrop_path":"\/ezXodpP429qK0Av89pVNlaXWJkQ.jpg","adult":false,"overview":"When a gunman takes five lives with six shots, all evidence points to the suspect in custody. On interrogation, the suspect offers up a single note: \"Get Jack Reacher!\" So begins an extraordinary chase for the truth, pitting Jack Reacher against an unexpected enemy, with a skill for violence and a secret to keep.","release_date":"2012-12-20"},{"vote_count":2317,"id":343611,"video":false,"vote_average":5.4,"title":"Jack Reacher: Never Go Back","popularity":17.9223,"poster_path":"\/IfB9hy4JH1eH6HEfIgIGORXi5h.jpg","original_language":"en","original_title":"Jack Reacher: Never Go Back","genre_ids":[28],"backdrop_path":"\/nDS8rddEK74HfAwCC5CoT6Cwzlt.jpg","adult":false,"overview":"Jack Reacher must uncover the truth behind a major government conspiracy in order to clear his name. On the run as a fugitive from the law, Reacher uncovers a potential secret from his past that could change his life forever.","release_date":"2016-10-19"}]}]] tResult = JSON.Decode(sReturn); Debug.Clear(); Debug.ShowWindow(true); for k,v in pairs (tResult) do Debug.Print(k..": "..tostring(v).."\r\n"); end
This is what it returns:
Code:
total_results: 2 total_pages: 1 page: 1
Nb. (Apz and JSON Plugin attached for reference)
Comment