Read and store a line from file

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

Read and store a line from file

Post by ngurram »

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: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Read and store a line from file

Post by FrancescoT »

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: 41
Joined: Mon Jun 08, 2020 6:54 pm

Re: Read and store a line from file

Post by ngurram »

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: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Read and store a line from file

Post by FrancescoT »

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: 41
Joined: Mon Jun 08, 2020 6:54 pm

Re: Read and store a line from file

Post by ngurram »

Thanks Francesco. Appreciate it.
Post Reply