SOLVE-SMART Posted 20 hours ago Posted 20 hours ago Hi @AspirinJunkieย ๐ , I would suggest to extend theย JSON-Test.au3ย by a example of how to write in the json file. If so, also adjust the README with this example. I cannot promise it, but I would add a PR (pull request) for that. But not in the next days - too much workload at the moment. What do you think? Is it worth it? Best regards Sven WildByDesign 1 ==> AutoIt related: ๐ GitHub, ๐ Discord Server, ๐ Cheat Sheet Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon)
WildByDesign Posted 19 hours ago Posted 19 hours ago 36 minutes ago, SOLVE-SMART said: I would suggest to extend theย JSON-Test.au3ย by a example of how to write in the json file. If so, also adjust the README with this example. I would agree with this. For AutoIt/JSON beginners like myself, this was exactly the first thing that I was looking for in an example from the various JSON UDFs. I don't think any of them had an example of a simple load/parse/modify/save JSON. I think that an example would certainly be beneficial. SOLVE-SMART 1
WildByDesign Posted 19 hours ago Posted 19 hours ago 1 hour ago, AspirinJunkie said: If you then want to write to the theme with _JSON_addChangeDelete() (which could make sense due to the nested structure), then you basically only need to determine the first free array index. Since you have an AutoIt data structure after _JSON_Parse(), you basically only need to make a Ubound to the themes array: This Ubound example is really nice. Short, sweet and concise. I ended up writing a Do...Until loop lastnight that is about 12 lines that does exactly what your single Ubound line does. Sometimes I learn and figure things out the hard way. However, I am definitely switching to your single line method now. 1 hour ago, AspirinJunkie said: Btw:, here's a little trick: With structures as complex as your theme description, you don't have to add everything manually. If you already know the structure beforehand, then simply describe it directly in JSON, have the theme element created completely from it and add it as a whole. In other words, you can replace the entire _JSON_addChangeDelete() in the example with a single one (similar to the jq example above): Now this is magical. It always amazed me, here in the AutoIt forums, how there always seems to be an almost unlimited amount of ways to achieve the same end goal. Thank you for enlightening me with several methods and for taking time out of your day to share your knowledge. It was helped tremendously. SOLVE-SMART 1
SOLVE-SMART Posted 18 hours ago Posted 18 hours ago Like @argumentumย suggested: In case we (you @WildByDesign) have more questions, let's create a new thread in the forum help section which references to this thread. Therefore the overview about the UDF will increase, at least in my understanding. Just to understand it: @AspirinJunkie do you prefer conversation about the UDF (library) here (in the forum as new threads) or as GitHub issues? Best regards Sven WildByDesign 1 ==> AutoIt related: ๐ GitHub, ๐ Discord Server, ๐ Cheat Sheet Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon)
TheDcoder Posted 18 hours ago Posted 18 hours ago 13 hours ago, WildByDesign said: Does that make the json array available in AutoIt already in some way or do I need to do something else to access it as an array? Once it is parsed the array is the same as any other Array in AutoIt , when you're done with modifying the array you can simply pass it as the value to your favourite JSON function without any additional steps Musashi and WildByDesign 2 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
AspirinJunkie Posted 12 hours ago Author Posted 12 hours ago 6 hours ago, WildByDesign said: I ended up writing a Do...Until loop lastnight that is about 12 lines that does exactly what your single Ubound line does. Yes, you can't know everything from the start. Either you assume that a certain functionality already exists - then you explicitly search for it. Or you implement the functionality yourself. You have done the latter and that shows that you have understood what is necessary and how to implement it. 6 hours ago, SOLVE-SMART said: Just to understand it: @AspirinJunkie do you prefer conversation about the UDF (library) here (in the forum as new threads) or as GitHub issues? I don't care in principle. However, I think it takes me longer with Github to see that something is there. In addition, only problems and feature requests should really be posted there and not a general discussion about how to deal with the UDF. ย 7 hours ago, SOLVE-SMART said: I would suggest to extend theย JSON-Test.au3ย by a example of how to write in the json file. If so, also adjust the README with this example. Ok - I just saw that the JSON-Test.au3 is still in German. I could adapt that at the same time. But I still don't quite know what is meant by "Write in the JSON file". How to create the JSON string is already shown in the example. Basically, all you need is a FileWrite and you're done. So perhaps I haven't quite understood what exactly needs to be added. WildByDesign 1
SOLVE-SMART Posted 10 hours ago Posted 10 hours ago 1 hour ago, AspirinJunkie said: [...] only problems and feature requests should really be posted there and not a general discussion about how to deal with the UDF. Totally fair and understandable. 1 hour ago, AspirinJunkie said: Ok - I just saw that the JSON-Test.au3 is still in German. I could adapt that at the same time. ๐ 1 hour ago, AspirinJunkie said: But I still don't quite know what is meant by "Write in the JSON file". How to create the JSON string is already shown in the example. Basically, all you need is a FileWrite and you're done. You're are right, it could be understandable, but it wasn't ๐ . Maybe @WildByDesignย can describe what would have helped him? As always, best regards Sven ==> AutoIt related: ๐ GitHub, ๐ Discord Server, ๐ Cheat Sheet Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon)
WildByDesign Posted 10 hours ago Posted 10 hours ago 4 minutes ago, SOLVE-SMART said: Maybe @WildByDesignย can describe what would have helped him? Absolutely. Please keep in mind that I am a complete AutoIt rookie. The examples show JSON code already in the example scripts as Global variables and parse/manipulate from there. The thing that would help a rookie like me the most would be to have an example script and an example .json file. The script would load the .json file from disk, parse json, modify some data and save those changes back to .json file on disk.ย That would have helped my rookie situation a lot. However, I also understand that some of that is outside of the responsibility for the UDF. But from an example perspective still would be beneficial. By the way, thank you all for your help. Cheers! TheDcoder, AspirinJunkie and SOLVE-SMART 2 1
SOLVE-SMART Posted 10 hours ago Posted 10 hours ago Don't belittle yourself so much ๐ , your knowledge of AutoIt isn't bad at all. But I get your point @WildByDesignย , yes. For beginners with JSON a proper example flow would be helpful. ๐คย TheDcoder and WildByDesign 1 1 ==> AutoIt related: ๐ GitHub, ๐ Discord Server, ๐ Cheat Sheet Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon)
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