jugador Posted April 10, 2022 Posted April 10, 2022 @Danp2 don't know what error you are talking just run @mLipok code with the modified Json_ObjExists & here's the output +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop Test #5 Empty: {"capabilities":"{}"} - 158 $v_Test = True - 161 $v_Test = False - 164 $v_Test = False Test #5 Result: {"capabilities":{"alwaysMatch":"{}","firstMatch":[{"proxy":{"noProxy":["www.google.com","www.yahoo.com"]}}]}} - 173 $v_Test = 2 - 176 $v_Test = 1 - 179 $v_Test = False - 182 $v_Test = True - 185 $v_Test = False - 188 $v_Test = True +>18:05:10 AutoIt3.exe ended.rc:0 +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop Test #5 Empty: {"capabilities":"{}"} - 158 $v_Test = True - 161 $v_Test = False +>18:13:52 AutoIt3.exe ended.rc:0
Danp2 Posted April 10, 2022 Posted April 10, 2022 @jugadorMaybe I misunderstood, but see my comment added below -- Func Json_ObjExists(ByRef $Object, $Key) Local $DynObject = $Object Local $Keys = StringSplit($Key, ".") For $x = 1 To $Keys[0] If $DynObject.Exists($Keys[$x]) Then ;~~~~ The error was occurring here If $x = $Keys[0] Then Return True Else $DynObject = Json_ObjGet($DynObject, $Keys[$x]) If Not IsObj($DynObject) Then Return False ;~~~~ add this line to Check if $DynObject is object EndIf Else Return False EndIf Next Return False EndFunc ;==>Json_ObjExists Latest Webdriver UDF Release Webdriver Wiki FAQs
jugador Posted April 10, 2022 Posted April 10, 2022 (edited) @Danp2 for 2nd example when Json_ObjGet try to find 'alwaysMatch' it failed as 'alwaysMatch' not exist so it return string $DynObject = Json_ObjGet($DynObject, $Keys[$x]) ConsoleWrite(VarGetType($DynObject) & @CRLF) that's why it failed on this line during 2nd loop If $DynObject.Exists($Keys[$x]) Then Edited April 10, 2022 by jugador
mLipok Posted April 10, 2022 Posted April 10, 2022 9 hours ago, jugador said: @mLipok try with this Json_ObjExists modification Func Json_ObjExists(ByRef $Object, $Key) Local $DynObject = $Object Local $Keys = StringSplit($Key, ".") For $x = 1 To $Keys[0] If $DynObject.Exists($Keys[$x]) Then If $x = $Keys[0] Then Return True Else $DynObject = Json_ObjGet($DynObject, $Keys[$x]) If Not IsObj($DynObject) Then Return False ;~~~~ add this line to Check if $DynObject is object EndIf Else Return False EndIf Next Return False EndFunc ;==>Json_ObjExists It fixes this issue. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
mLipok Posted April 10, 2022 Posted April 10, 2022 (edited) The same problem occurs in: #include "Json.au3" test6() Func test6() Local $_WD_CAPS__OBJECT Json_Put($_WD_CAPS__OBJECT, '[capabilities]', '{}') ConsoleWrite("Test #5 Empty: " & Json_Encode($_WD_CAPS__OBJECT) & @LF) Local $DynObject = Json_ObjGet($_WD_CAPS__OBJECT, 'capabilities.alwaysMatch') #forceref $DynObject EndFunc ;==>test6 Edited April 10, 2022 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
mLipok Posted April 10, 2022 Posted April 10, 2022 @Danp2 take a look on this testing script: expandcollapse popup#include "Json.au3" test5() Func test5() Local $_WD_CAPS__OBJECT Local $v_Test Json_Put($_WD_CAPS__OBJECT, '[capabilities]', '{}') ConsoleWrite("Test #5 Empty: " & Json_Encode($_WD_CAPS__OBJECT) & @LF) Local $DynObject = Json_ObjGet($_WD_CAPS__OBJECT, 'capabilities') $DynObject = Json_ObjGet($DynObject, 'alwaysMatch') $v_Test = Json_ObjExists2($_WD_CAPS__OBJECT, 'capabilities.alwaysMatch') ConsoleWrite("- " & @ScriptLineNumber & ' $v_Test = ' & $v_Test & @CRLF) EndFunc ;==>test5 Func Json_ObjExists2(ByRef $Object, $Key) ;~ https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn/?do=findComment&comment=1499979 Local $DynObject = $Object Local $Keys = StringSplit($Key, ".") For $x = 1 To $Keys[0] ConsoleWrite("> " & $x & ' / ' & $Keys[0] & ' $Keys[$x] = ' & $Keys[$x] & @CRLF) If $DynObject.Exists($Keys[$x]) Then ConsoleWrite(@ScriptLineNumber & @CRLF) If $x = $Keys[0] Then ConsoleWrite(@ScriptLineNumber & @CRLF) Return True Else ConsoleWrite(@ScriptLineNumber & ' ' & VarGetType($DynObject) & @CRLF) $DynObject = Json_ObjGet($DynObject, $Keys[$x]) ConsoleWrite(@ScriptLineNumber & ' ' & VarGetType($DynObject) & ' >> ' & $DynObject & @CRLF) ;~ If Not IsObj($DynObject) Then Return False ;~~~~ add this line to Check if $DynObject is object EndIf Else Return False EndIf Next Return False EndFunc ;==>Json_ObjExists Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
mLipok Posted April 10, 2022 Posted April 10, 2022 (edited) I would like to propose to change Json_ObjExists() function to this form: ; #FUNCTION# ==================================================================================================================== ; Name ..........: Json_ObjExists ; Description ...: Check if desired key in JSON structure exist or not ; Syntax ........: Json_ObjExists(Byref $Object, $Key) ; Parameters ....: $Object - reference to object containing JSON structure ; $Key - location for desired key in JSON structure ; Return values .: True/False ; Author ........: Ward ; Modified ......: Jos, jugador, mLipok ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func Json_ObjExists(ByRef $Object, $Key) Local $DynObject = $Object Local $Keys = StringSplit($Key, ".") For $x = 1 To $Keys[0] ; go through the keys If Not $DynObject.Exists($Keys[$x]) Then Return False ; if current key not exist If $x = $Keys[0] Then Return True ; if exist and it is the last key $DynObject = Json_ObjGet($DynObject, $Keys[$x]) ; move to next key If Not IsObj($DynObject) Then Return False ; if next key not exist Next Return False ; if not found EndFunc ;==>Json_ObjExists instead current version: Func Json_ObjExists2(ByRef $Object, $Key) Local $DynObject = $Object Local $Keys = StringSplit($Key, ".") For $x = 1 To $Keys[0] If $DynObject.Exists($Keys[$x]) Then If $x = $Keys[0] Then Return True Else $DynObject = Json_ObjGet($DynObject, $Keys[$x]) EndIf Else Return False EndIf Next Return False EndFunc ;==>Json_ObjExists Edited April 10, 2022 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
mLipok Posted April 10, 2022 Posted April 10, 2022 I would like to propose to change Json_ObjExists() function to this form: ; #FUNCTION# ==================================================================================================================== ; Name ..........: Json_ObjGet ; Description ...: Get object refrence to any descendants key in JSON structure ; Syntax ........: Json_ObjGet(Byref $Object, $Key) ; Parameters ....: $Object - reference to object containing JSON structure ; $Key - location for desired key in JSON structure ; Return values .: #TODO ; Author ........: Ward ; Modified ......: Jos, mLipok ; Remarks .......: if last key is returning in empty object which contain "{}" it will return string not object ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func Json_ObjGet(ByRef $Object, $Key) Local $DynObject = $Object Local $Keys = StringSplit($Key, ".") For $x = 1 To $Keys[0] ; go through the keys If Not $DynObject.Exists($Keys[$x]) Then Return SetError(1, 0, '') ; if current key not exist If $x = $Keys[0] Then Return $DynObject.Item($Keys[$x]) ; if exist and it is the last key $DynObject = Json_ObjGet($DynObject, $Keys[$x]) ; move to next key If Not IsObj($DynObject) Then Return SetError(2, 0, '') ; if next key not exist Next Return SetError(3, 0, '') ; if not found EndFunc ;==>Json_ObjGet instead: Func Json_ObjGet(ByRef $Object, $Key) Local $DynObject = $Object Local $Keys = StringSplit($Key, ".") For $x = 1 To $Keys[0] If $DynObject.Exists($Keys[$x]) Then If $x = $Keys[0] Then Return $DynObject.Item($Keys[$x]) Else $DynObject = Json_ObjGet($DynObject, $Keys[$x]) EndIf EndIf Next Return SetError(1, 0, '') EndFunc ;==>Json_ObjGet Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
mLipok Posted April 10, 2022 Posted April 10, 2022 (edited) here is some new testing script for Json_ObjGet() function: expandcollapse popup#include "Json.au3" test6() Func test6() Local $_WD_CAPS__OBJECT, $DynObject Json_Put($_WD_CAPS__OBJECT, '[capabilities]', '{}') ConsoleWrite("Test #6 Empty: " & Json_Encode($_WD_CAPS__OBJECT) & @LF) $DynObject = Json_ObjGet($_WD_CAPS__OBJECT, 'capabilities') ConsoleWrite("- " & @ScriptLineNumber & ' @error = ' & @error & ' IsObj = ' & IsObj($DynObject) & ' $DynObject = ' & Json_Encode($DynObject) & @LF) $DynObject = Json_ObjGet($_WD_CAPS__OBJECT, 'capabilities.alwaysMatch') ConsoleWrite("- " & @ScriptLineNumber & ' @error = ' & @error & ' IsObj = ' & IsObj($DynObject) & ' $DynObject = ' & Json_Encode($DynObject) & @LF) Json_Put($_WD_CAPS__OBJECT, '[capabilities][alwaysMatch]', '{}') ConsoleWrite("Test #6 Empty: " & Json_Encode($_WD_CAPS__OBJECT) & @LF) $DynObject = Json_ObjGet($_WD_CAPS__OBJECT, 'capabilities') ConsoleWrite("- " & @ScriptLineNumber & ' @error = ' & @error & ' IsObj = ' & IsObj($DynObject) & ' $DynObject = ' & Json_Encode($DynObject) & @LF) $DynObject = Json_ObjGet($_WD_CAPS__OBJECT, 'capabilities.alwaysMatch') ConsoleWrite("- " & @ScriptLineNumber & ' @error = ' & @error & ' IsObj = ' & IsObj($DynObject) & ' $DynObject = ' & Json_Encode($DynObject) & @LF) EndFunc ;==>test6 ; #FUNCTION# ==================================================================================================================== ; Name ..........: Json_ObjGet ; Description ...: Get object refrence to any descendants key in JSON structure ; Syntax ........: Json_ObjGet(Byref $Object, $Key) ; Parameters ....: $Object - reference to object containing JSON structure ; $Key - location for desired key in JSON structure ; Return values .: #TODO ; Author ........: Ward ; Modified ......: Jos, mLipok ; Remarks .......: if last key is returning in empty object which contain "{}" it will return string not object ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func Json_ObjGet2(ByRef $Object, $Key) Local $DynObject = $Object Local $Keys = StringSplit($Key, ".") For $x = 1 To $Keys[0] ; go through the keys If Not $DynObject.Exists($Keys[$x]) Then Return SetError(1, 0, '') ; if current key not exist If $x = $Keys[0] Then Return $DynObject.Item($Keys[$x]) ; if exist and it is the last key $DynObject = Json_ObjGet($DynObject, $Keys[$x]) ; move to next key If Not IsObj($DynObject) Then Return SetError(2, 0, '') ; if next key not exist Next Return SetError(3, 0, '') ; if not found EndFunc ;==>Json_ObjGet2 Edited April 10, 2022 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
mLipok Posted April 10, 2022 Posted April 10, 2022 I've always had the feeling that I don't have an advanced example here that clearly shows how to formulate KEYS to achieve the desired JSON structure. Hopefully this example below will make things clearer for other users of this UDF, I mean those who haven't fully understood it yet. expandcollapse popup#include "Json.au3" test7() Func test7() Local $Obj Json_Put($Obj, ".Primitive_1", "Test") ; JSON_PRIMITE "Primitive_1" Json_Put($Obj, ".Primitive_2", True) ; JSON_PRIMITE "Primitive_2" Json_Put($Obj, ".Primitive_3", False) ; JSON_PRIMITE "Primitive_3" Json_Put($Obj, ".Primitive_4", Null) ; JSON_PRIMITE "Primitive_4" Json_Put($Obj, ".List_A[0]", "Test") ; JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[1]", True) ; JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[2]", False) ; JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[3]", Null) ; JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[4]", "value_A=100") ; JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[4].Object_1", "{}") ; JSON_OBJECT "Object_1" as subelement of JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[4].Object_1.List_A_B[0]", "Test") ; JSON_ARRAY "List_A_B" as subelement of JSON_OBJECT "Object_1" which is subelement of JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[4].Object_1.List_A_B[1]", True) ; JSON_ARRAY "List_A_B" as subelement of JSON_OBJECT "Object_1" which is subelement of JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[4].Object_1.List_A_B[2]", False) ; JSON_ARRAY "List_A_B" as subelement of JSON_OBJECT "Object_1" which is subelement of JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[4].Object_1.List_A_B[3]", Null) ; JSON_ARRAY "List_A_B" as subelement of JSON_OBJECT "Object_1" which is subelement of JSON_ARRAY "List_A" Json_Put($Obj, ".List_A[4].Object_1.List_A_B[4]", "value_A_B=100") ; JSON_OBJECT Json_Put($Obj, ".List_C[0]", "Test") ; JSON_CRRAY "List_C" Json_Put($Obj, ".List_C[1]", True) ; JSON_CRRAY "List_C" Json_Put($Obj, ".List_C[2]", False) ; JSON_CRRAY "List_C" Json_Put($Obj, ".List_C[3]", Null) ; JSON_CRRAY "List_C" Json_Put($Obj, ".List_C[4]", "value_C=100") ; JSON_CRRAY "List_C" Json_Put($Obj, ".List_D[0].Object_2.List_D_E[0]", "Test") ; JSON_DRRAY "List_D_E" as subelement of JSON_OBJECT "Object_2" which is subelement of JSON_DRRAY "List_D" Json_Put($Obj, ".List_D[0].Object_2.List_D_E[1]", True) ; JSON_DRRAY "List_D_E" as subelement of JSON_OBJECT "Object_2" which is subelement of JSON_DRRAY "List_D" Json_Put($Obj, ".List_D[0].Object_2.List_D_E[2]", False) ; JSON_DRRAY "List_D_E" as subelement of JSON_OBJECT "Object_2" which is subelement of JSON_DRRAY "List_D" Json_Put($Obj, ".List_D[0].Object_2.List_D_E[3]", Null) ; JSON_DRRAY "List_D_E" as subelement of JSON_OBJECT "Object_2" which is subelement of JSON_DRRAY "List_D" Json_Put($Obj, ".List_D[0].Object_2.List_D_E[4]", "value_D_E=100") ; JSON_OBJECT Json_Put($Obj, ".List_D[0].Object_3.List_D_F[0]", "Test") ; JSON_DRRAY "List_D_F" as subelement of JSON_OBJECT "Object_3" which is subelement of JSON_DRRAY "List_D" Json_Put($Obj, ".List_D[0].Object_3.List_D_F[1]", True) ; JSON_DRRAY "List_D_F" as subelement of JSON_OBJECT "Object_3" which is subelement of JSON_DRRAY "List_D" Json_Put($Obj, ".List_D[0].Object_3.List_D_F[2]", False) ; JSON_DRRAY "List_D_F" as subelement of JSON_OBJECT "Object_3" which is subelement of JSON_DRRAY "List_D" Json_Put($Obj, ".List_D[0].Object_3.List_D_F[3]", Null) ; JSON_DRRAY "List_D_F" as subelement of JSON_OBJECT "Object_3" which is subelement of JSON_DRRAY "List_D" Json_Put($Obj, ".List_D[0].Object_3.List_D_F[4]", "value_D_F=100") ; JSON_OBJECT Json_Put($Obj, ".Empty_object", "{}") ; JSON_OBJECT "Empty_object" with out any elements ConsoleWrite("JSON structure: " & Json_Encode($Obj) & @LF) ConsoleWrite("JSON structure PRETTY PRINT: " & @LF & Json_Encode($Obj, $JSON_PRETTY_PRINT) & @LF) EndFunc ;==>test7 it produce: expandcollapse popup{ "Primitive_1": "Test", "Primitive_2": true, "Primitive_3": false, "Primitive_4": null, "List_A": [ "Test", true, false, null, { "Object_1": { "List_A_B": [ "Test", true, false, null, "value_A_B=100" ] } } ], "List_C": [ "Test", true, false, null, "value_C=100" ], "List_D": [ { "Object_2": { "List_D_E": [ "Test", true, false, null, "value_D_E=100" ] }, "Object_3": { "List_D_F": [ "Test", true, false, null, "value_D_F=100" ] } } ], "Empty_object": "{}" } argumentum 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
Mateocedillo Posted July 1, 2022 Posted July 1, 2022 Hello, Can you speed up the processing speed on long JSONs that contains much items? That is, I have a JSON that has an array of more than a thousand elements and I am getting them all in an Array but it takes a long time, depending on the number of elements. In other cases like browsers or Python it gets them all almost instantly. I have the latest dependency (2021.11.06).
Developers Jos Posted July 2, 2022 Developers Posted July 2, 2022 (edited) Let me know when you are done and we will implement your version. Edited July 2, 2022 by Jos TheDcoder and MrKm 2 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.
Danyfirex Posted July 2, 2022 Posted July 2, 2022 (edited) @Jos don't be rude. I'm sure He was not requesting/asking in a imposed way. I think He is asking if is possible to speed it up. You woke up on the wrong foot today. 😢 @Mateocedillo try this UDF. PD: Mateocedillo is a blind person. Saludos Edited July 2, 2022 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
TheDcoder Posted July 2, 2022 Posted July 2, 2022 1 hour ago, Danyfirex said: @Mateocedillo try this UDF. This UDF looks dangerous, lots of opportunities for code injection exploits! I wouldn't recommend anyone to use this. @Mateocedillo I'd suggest you to use an external tool like jq to parse your large JSON data. I think someone may have even made an AutoIt UDF which uses jq EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
mLipok Posted July 2, 2022 Posted July 2, 2022 TheDcoder 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
jugador Posted July 3, 2022 Posted July 3, 2022 If @TheDcoder said it "This UDF looks dangerous" then it has to be dangerous Mr @TheDcoder as you have decoded the malicious intent then why not do a favour to Autoit community and report the Mod to delete Json2 thread. To those who still want to use it even after @TheDcoder warning 1) json2.js => github link given 2) link to Danyfirex thread given from where Base64 String taken 3) or use Base64 decoder to check the Base64 String TheDcoder 1
TheDcoder Posted July 3, 2022 Posted July 3, 2022 @jugador You seem offended, sorry. But I wasn't suggesting that your UDF is malicious, I was simply pointing out the fact that it is not secure. As per my understanding, you use Microsoft's JScript engine to parse JSON by passing it as input to your own function, but the input is not sanitized to protect against arbitrary code, am I right? A malicious JSON payload might contain code within the JSON or even outside it which is executed without the user's or script author's knowledge. It is important that the JSON input is sanitized because it is directly being injected as code which is run. mLipok 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
Developers Jos Posted July 3, 2022 Developers Posted July 3, 2022 @TheDcoder, Isn't the same true for Compiled script by definition with the encoded script being in the PE header TheDcoder 1 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.
TheDcoder Posted July 3, 2022 Posted July 3, 2022 (edited) @Jos Are we talking about compiled AutoIt scripts? If so I don't think I understand, please explain Edited July 3, 2022 by TheDcoder EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
Developers Jos Posted July 3, 2022 Developers Posted July 3, 2022 4 hours ago, TheDcoder said: Are we talking about compiled AutoIt scripts? If so I don't think I understand, please explain Yes .... and no, not up for further discussion in the open forum. My point is that this talk about code injection is somewhat far-fetched. 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.
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