TheXman Posted October 6, 2019 Share Posted October 6, 2019 (edited) 27 minutes ago, loulou2522 said: Where can i fin and downlaod json.au3. ? The bottom of the first post of this topic. Edited October 6, 2019 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
JoeBar Posted November 14, 2019 Share Posted November 14, 2019 The lastest version is not on this post. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 14, 2019 Developers Share Posted November 14, 2019 Correct as there's an issue with that latest version that I have been unable to resolve I reverted to the previous version. Updates the first post and change the last text with a strikethrough so it is clear, but the line above does contain the file and the reason for reverting. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
TheOne23 Posted December 9, 2019 Share Posted December 9, 2019 Hi Guys, Can someone direct me to the download path of Jason.au3 UDF download page or JSMN.au3? Thanks in advance. Link to comment Share on other sites More sharing options...
JoeBar Posted December 9, 2019 Share Posted December 9, 2019 1 minute ago, TheOne23 said: Hi Guys, Can someone direct me to the download path of Jason.au3 UDF download page or JSMN.au3? Thanks in advance. JasonvsFreddy.au3 ? 😄 For the files, see bottom of the 1st post. Link to comment Share on other sites More sharing options...
TheOne23 Posted December 9, 2019 Share Posted December 9, 2019 @JoeBar Thank you for your response. I like your comment there haha! It should be json - not really familiar of it actually Link to comment Share on other sites More sharing options...
auitden Posted December 26, 2019 Share Posted December 26, 2019 Hello. I have json like this {"response":("userid":"4798","success":1)} Please, help me add this values to variables, I have "Error: Error in expression" :( $object = json_decode($data) $message=json_get($object,["userid"]) MsgBox("","Test",$message) I want make like this logic: if success = 1 then popup message with "4798" (userid content), else (if success = 0) then message with "error". Link to comment Share on other sites More sharing options...
TheXman Posted December 26, 2019 Share Posted December 26, 2019 (edited) 23 minutes ago, auitden said: {"response":("userid":"4798","success":1)} Your JSON example is invalid. Just plug it into any JSON validator on the web and you will see. It most likely should have been something like: {"response":{"userid":"4798","success":1}} Correct your JSON and try again. Use the json_dump() function to get an idea of how to reference json values using the dot-notation. #include <MyIncludes\json\json.au3> ;<== Change to your location $data = '{"response":{"userid":"4798","success":1}}' Json_Dump($data) $object = json_decode($data) $message=json_get($object,".response.userid") ;using dot-notation ;~ $message=json_get($object,"[response][userid]") ;using bracket-notation MsgBox("","Test",$message) Output: +-> .response.userid =4798 +-> .response.success =1 @auitden: I updated my response with an example using your original script snippet. Edited December 26, 2019 by TheXman auitden 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
auitden Posted December 26, 2019 Share Posted December 26, 2019 Sorry, my mistake when typing from keyboard, i think json is correct, copy paste now {"response":{"userid":"4798","success":1}} Link to comment Share on other sites More sharing options...
argumentum Posted December 26, 2019 Share Posted December 26, 2019 (edited) #include "Json.au3" TestThis() Func TestThis() Local $myJson = '{"response":{"userid":"4798","success":1}}' Json_Dump($myJson) ; to get what you look for Local $oTemp = Json_Decode($myJson) Local $my_userid = Json_ObjGet($oTemp, ".response.userid") ; use what you look for here Local $my_success = Json_ObjGet($oTemp, ".response.success") ConsoleWrite('- $my_userid = "' & $my_userid & '"' & @CRLF) ConsoleWrite('- $my_success = ' & $my_success & @CRLF) EndFunc Edited December 26, 2019 by argumentum better code auitden 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
auitden Posted December 26, 2019 Share Posted December 26, 2019 All example perfect and works fine. Thank you very much! When I use $data = _INetGetSource($URL) then $data print to msgbox looks fine, but after parsing I see blank screen. Json have utf-8. I think that is codepage problem... Link to comment Share on other sites More sharing options...
argumentum Posted December 26, 2019 Share Posted December 26, 2019 (edited) _INetGetSource ( $sURL [, $bString = True] ) $sURL(The URL of the site.) eg 'http://www.autoitscript.com' $bString[optional] If True the data is returned in string format, otherwise binary format. $data = _INetGetSource($URL) <-- without the URL that is all the help I can give but try to ConsoleWrite('"' & $data & '"' & @CRLF) Edit: I'd use binary and do my own bin2str conversion Edited December 26, 2019 by argumentum better Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
auitden Posted December 26, 2019 Share Posted December 26, 2019 6 minutes ago, argumentum said: _INetGetSource ( $sURL [, $bString = True] ) $sURL(The URL of the site.) eg 'http://www.autoitscript.com' $bString[optional] If True the data is returned in string format, otherwise binary format. $URL="http://192.168.1.50" $data = _INetGetSource($URL , $bString = 'True') ;$data = '{"response":{"userid":"4798","success":1}}' Json_Dump($data) $object = json_decode($data) $message=json_get($object,".response.userid") MsgBox("","Test",$message) Blank screen Link to comment Share on other sites More sharing options...
argumentum Posted December 26, 2019 Share Posted December 26, 2019 (edited) 1) 192.168.1.50 is your internal IP 2) $bString = 'True' will equal false( i guess ), so use True or False. Edited December 26, 2019 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
auitden Posted December 26, 2019 Share Posted December 26, 2019 4 minutes ago, argumentum said: 1) 192.168.1.50 is your internal IP 2) $bString = 'True' will equal false( i guess ), so use True or False. 1) it's for example, i can't share this 2) true or false, i already have this in console output: "0x7B22726573706F6E7365223A7B22737465616D6964223A363536313139383939363737313336...654433" Link to comment Share on other sites More sharing options...
argumentum Posted December 26, 2019 Share Posted December 26, 2019 9 minutes ago, auitden said: "0x7B22726573706F6E7365223A7B ok, this is compressed HTML ?, ...these first characters are not "text", they are control characters. Also, this is not JSON related anymore, so, I would open a help thread in the help section to keep the unrelated help concise. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
auitden Posted December 26, 2019 Share Posted December 26, 2019 $data = _INetGetSource($URL) $sdata = BinaryToString($data) ConsoleWrite('"' & $sdata & '"' & @CRLF) ;$data = '{"response":{"userid":"4798","success":1}}' Json_Dump($sdata) $object = json_decode($sdata) $message=json_get($object,".response.userid") MsgBox("","Test",$message) ConsoleWrite works Fine! MsgBox - blank screen Link to comment Share on other sites More sharing options...
auitden Posted December 26, 2019 Share Posted December 26, 2019 My fault, right now works fine! Thank you very much guys! Link to comment Share on other sites More sharing options...
zer0n00b Posted March 27, 2020 Share Posted March 27, 2020 Hello! I have $super = json_get($object, '.result.items[1].name') It's work correctly, but how i can check all items [0-1-2-3] or more ? i don't know how many? and if name = templateword then $i = i+1 Link to comment Share on other sites More sharing options...
Developers Jos Posted March 27, 2020 Developers Share Posted March 27, 2020 2 hours ago, zer0n00b said: but how i can check all items [0-1-2-3] or more ? Please post an example of the data and what you like to retrieve so we understand what you are looking for. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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