BinaryBrother Posted September 10, 2013 Share Posted September 10, 2013 (edited) I'm having as much trouble figuring out how JSON works as I did learning a little SQL. I've tried 4 of the different JSON UDFs around the forums, and I'm on day 3 of trying to figure this out myself... I'm actually beginning to worry that my JSON data is bad. I tried messing with associative arrays./?do=embed' frameborder='0' data-embedContent>> An old[er]? JSON UDF:/?do=embed#entry1111352'' frameborder='0' data-embedContent>> A new RFC compliant one:'?do=embed' frameborder='0' data-embedContent>> and the "non-strict" one: I'm building a Google Voice UDF for AutoIt and found out how to get JSON return values for everything I need, which I've heard is what I want. Could someone just show me a quick example of iterating through the different JSON values? I was able to get the RFC compliant one to spit out a little info, which had me hopeful, but still stumped. $t = FileRead("C:\Users\Owner\Downloads\download.xml") $test = _JSONDecodeall($t) _ArrayDisplay($test[0]) $test1 = _JSONDecode($t, 'messages') $test2 = _JSONDecode($t, 'JSON_unpack') _ArrayDisplay($test1) _ArrayDisplay($test2) You can grab your own JSON examples from here.http://google.com/voice/request/messages If an old or trusted member, MVP, or that bum trancexx, needs my JSON output, I'll PM it. Edited September 11, 2013 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2013 Share Posted September 10, 2013 (edited) If I want to get swf player location from the downloaded file I run this:#include "JSMN.au3" $sPlayer = Jsmn_ObjGet(Jsmn_Decode(FileRead("C:\Users\Owner\Downloads\download.xml")), "swfPlayer") ConsoleWrite($sPlayer & @CRLF)... and get:/voice/resources/532502447-audioPlayer.swfIs that wrong? Edited September 10, 2013 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
BinaryBrother Posted September 10, 2013 Author Share Posted September 10, 2013 (edited) Thanks for your helpful reply, trancexx. Using your example, I get the same output as you. However, when I try to get "messages", "messageList", "id", or anything else, it just returns blank. I'm so lost in this JSON abyss. Edit: I just discovered a resource that, I believe, will greatly help me in this project. It has allowed me to visualize JSON data and its structure. Resource: http://jsonviewer.stack.hu/ Edited September 10, 2013 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2013 Share Posted September 10, 2013 If it's blank then it's blank, empty, none, false, null. That's also valid result.For "r" I get hEmccRP60m9YRRfUdF6uXRMKOKk=, for "resultsPerPage" I get 5, etc... ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
BinaryBrother Posted September 10, 2013 Author Share Posted September 10, 2013 (edited) Ultimately, I'm trying to access the actual message text and relevant information, ex; Who texted me and from which number. That information is in the JSON data. I believe I am after the array of information inside "messageList".http://screencast.com/t/LQlwFbIYJ $test = Jsmn_Decode(FileRead("C:\Users\Owner\Downloads\messages")) $sPlayer = Jsmn_ObjGet($test, "messageList") _ArrayDisplay($sPlayer) This gives me an empty $array[5], but it is correctly sized to fit the data. I'm a lot closer now, though. I wasn't getting any values, before. Edited September 11, 2013 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2013 Share Posted September 10, 2013 I see you no longer require MVP status for the member with whom you would share json file with. I'm also not old and not even trusted by some. Hm. What now?Send me your file. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
BinaryBrother Posted September 10, 2013 Author Share Posted September 10, 2013 Of course I trust you, trancexx. That's actually why I changed it from MVP, because of your status not being MVP. *PM Sent with my JSON data. SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2013 Share Posted September 10, 2013 Of course I trust you, trancexx. That's actually why I changed it from MVP, because of your status not being MVP. Oh, then it's MVP member, old member, trusted member or trancexx. Okly dokly. That's fine. BinaryBrother 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
BinaryBrother Posted September 10, 2013 Author Share Posted September 10, 2013 (edited) trancexx has provided me everything that I need for figuring out the rest. As soon as I'm done with this UDF, I'll post it in the examples section. Many thanks, trancexx. Of course, it didn't help when most other JSON documentation says that JSON key/value pairs are normally accessed like, $Array = $JSON.MessagesArray $Var = $Object.Username Or $Username = $JSON.Key("Username") But the method seems to be a bit different with AutoIt. Edited September 11, 2013 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now