I have a requirement whereby I need to fetch a set of jsons before making a API call. I am planning to add these json strings in app.config as shown below
<add key="Jsons" value="{""Id"":""25"",""Name"":""Value-1""}"/>
However adding this results in a compilation error "Missing whitespace" at the start of the value. Please let me know if i am missing something. I dont want to create a separate text file to read jsons from. Thats why i decided to use app.config itself
JSON format, intended initially to replace XML for data-interchange, is widely used today to provide public data using APIs and web services as well as to write various configuration files.
config. js, app. config. ts) is used for configuring how a project loads in Expo Go, Expo Prebuild generation, and the OTA update manifest.
CreateDefaultBuilder(args) //This is how you attach additional JSON files . ConfigureAppConfiguration((hostingContext, config) => { config. AddJsonFile("customSettings. json", optional: false, reloadOnChange: false); }) //End of update .
Your quotes are not correctly formatted. Can you try this:
<add key="Jsons" value='{"Id":"25","Name":"Value-1"}'/>
An app.config
is still XML! You need to use the XML escape sequence for quotes.
<add key="Jsons" value="{"Id":"25","Name":"Value-1"}"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With