Jump to content

Recommended Posts

Posted

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

==> 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)

Posted
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. :)

Posted
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.

Posted

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

==> 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)

Posted
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 :D

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

Posted
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.

Posted
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)

Posted
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! :)

Posted

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.

๐Ÿคย 

==> 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)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...