Page 1 of 1

Read and store a line from file

Posted: Fri Jan 29, 2021 9:53 pm
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.

Re: Read and store a line from file

Posted: Mon Feb 01, 2021 12:07 pm
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.

Re: Read and store a line from file

Posted: Mon Feb 01, 2021 2:55 pm
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

Re: Read and store a line from file

Posted: Tue Feb 02, 2021 10:22 am
by FrancescoT
I'll add your request to our to-do list...let's see what happens.

Thanks!

Re: Read and store a line from file

Posted: Tue Feb 02, 2021 1:33 pm
by ngurram
Thanks Francesco. Appreciate it.