Forum Discussion

Sabiha's avatar
Sabiha
Occasional Contributor
4 years ago

Reading/setting values in appsettings.json file

Hi everyone,    I need to read the localization settings from my appsettings.json  file  on my server and possible update them too as part of my automated testing. Basically, I need to be able chec...
  • Sabiha's avatar
    Sabiha
    4 years ago

    Thanks for your reply AlexKaras 

     

    Just wanted to update to say that I had managed to get something working, similar to your code above, but using JSON.parse

     

    var fileContents = aqFile.ReadWholeTextFile(filePath, aqFile.ctANSI)

    var  appSettings = JSON.parse(fileContents)
    var defaultLanguage = appSettings.MyID.Localization.FallbackLanguage
    return defaultLanguage

     

    I haven't tried updating the file yet, haven't need to so far...