Read and store a line from file

Got a problem you cannot solve? Try here.
ngurram
Posts: 36
Joined: Mon Jun 08, 2020 6:54 pm

Read and store a line from file

Postby ngurram » Fri Jan 29, 2021 9:53 pm

Hi,
I am trying to read from appsettings.json for a particular key / value pair and store it in a variable. Is this possible with IA?

I realize there is Parse string, but it feels fragile. If new keys are added around the pair I am looking to find and store, then it will break.

Thanks in advance.

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Read and store a line from file

Postby FrancescoT » Mon Feb 01, 2021 12:07 pm

Unfortunately, there isn't a built-in method for reading or importing a key from a json file.

The only option is with using 'Read from Text File' command, and then 'Parse String' to isolate a specific key.

Alternatively, you may develop your own method in a EXE or DLL ...or a plugin.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

ngurram
Posts: 36
Joined: Mon Jun 08, 2020 6:54 pm

Re: Read and store a line from file

Postby ngurram » Mon Feb 01, 2021 2:55 pm

Thanks Francesco, That's exactly what I am doing right now. Read from text and parse.
But I was hoping for more robust approach to do this. Even if the appsettings keys / values placement between other keys changes in future, I was hoping there was a way to keep finding the right key / value pair.

Do you know if there's any plan to support json parsing by IA in the future since JSon for appsettings is becoming more and more common?

Thanks

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Read and store a line from file

Postby FrancescoT » Tue Feb 02, 2021 10:22 am

I'll add your request to our to-do list...let's see what happens.

Thanks!
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

ngurram
Posts: 36
Joined: Mon Jun 08, 2020 6:54 pm

Re: Read and store a line from file

Postby ngurram » Tue Feb 02, 2021 1:33 pm

Thanks Francesco. Appreciate it.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 34 guests