{"id":227928,"date":"2024-07-18T11:13:20","date_gmt":"2024-07-18T11:13:20","guid":{"rendered":"https:\/\/namso-gen.co\/blog\/?p=227928"},"modified":"2024-07-18T11:13:20","modified_gmt":"2024-07-18T11:13:20","slug":"how-to-get-value-from-appsettings-json-in-net-core","status":"publish","type":"post","link":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/","title":{"rendered":"How to get value from appsettings.json in .NET Core?"},"content":{"rendered":"<p>In .NET Core, the appsettings.json file plays a vital role in storing application settings. It allows developers to separate configuration from code, making it easier to modify settings without redeploying the application. Retrieving values from appsettings.json is a common requirement, and fortunately, it&#8217;s straightforward to accomplish in .NET Core.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_62 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#The_appsettingsjson_file\" title=\"The appsettings.json file\">The appsettings.json file<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#Accessing_appsettingsjson_values\" title=\"Accessing appsettings.json values\">Accessing appsettings.json values<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#How_to_get_value_from_appsettingsjson_in_NET_Core\" title=\"How to get value from appsettings.json in .NET Core?\">How to get value from appsettings.json in .NET Core?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#Frequently_Asked_Questions_FAQs\" title=\"Frequently Asked Questions (FAQs)\">Frequently Asked Questions (FAQs)<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#1_Can_I_have_multiple_appsettingsjson_files\" title=\"1. Can I have multiple appsettings.json files?\">1. Can I have multiple appsettings.json files?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#2_How_to_load_settings_from_a_specific_appsettings_file\" title=\"2. How to load settings from a specific appsettings file?\">2. How to load settings from a specific appsettings file?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#3_Can_I_use_a_different_name_for_the_appsettings_file\" title=\"3. Can I use a different name for the appsettings file?\">3. Can I use a different name for the appsettings file?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#4_Can_I_store_sensitive_information_in_appsettingsjson\" title=\"4. Can I store sensitive information in appsettings.json?\">4. Can I store sensitive information in appsettings.json?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#5_How_to_bind_appsettings_values_to_a_strongly-typed_class\" title=\"5. How to bind appsettings values to a strongly-typed class?\">5. How to bind appsettings values to a strongly-typed class?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#6_How_to_reload_appsettingsjson_without_restarting_the_application\" title=\"6. How to reload appsettings.json without restarting the application?\">6. How to reload appsettings.json without restarting the application?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#7_Can_I_access_the_configuration_values_in_a_static_class\" title=\"7. Can I access the configuration values in a static class?\">7. Can I access the configuration values in a static class?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#8_Can_I_use_dependency_injection_in_appsettingsjson\" title=\"8. Can I use dependency injection in appsettings.json?\">8. Can I use dependency injection in appsettings.json?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#9_Can_I_specify_default_values_for_appsettings_values\" title=\"9. Can I specify default values for appsettings values?\">9. Can I specify default values for appsettings values?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#10_How_can_I_access_nested_settings_in_appsettingsjson\" title=\"10. How can I access nested settings in appsettings.json?\">10. How can I access nested settings in appsettings.json?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#11_How_can_I_access_values_from_environment_variables\" title=\"11. How can I access values from environment variables?\">11. How can I access values from environment variables?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#12_Can_I_modify_appsettingsjson_at_runtime\" title=\"12. Can I modify appsettings.json at runtime?\">12. Can I modify appsettings.json at runtime?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"The_appsettingsjson_file\"><\/span>The appsettings.json file<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Before we dive into obtaining values from appsettings.json, let&#8217;s first understand its structure. The appsettings.json file is typically located at the root of the project and follows a key-value pair format, similar to a JSON object. Here&#8217;s an example:<\/p>\n<p>&#8220;`json<br \/>\n{<br \/>\n  &#8220;MySetting&#8221;: &#8220;Hello, world!&#8221;,<br \/>\n  &#8220;ConnectionStrings&#8221;: {<br \/>\n    &#8220;DefaultConnection&#8221;: &#8220;Server=myServerAddress;Database=myDataBase;User=myUser;Password=myPassword;&#8221;<br \/>\n  }<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p>In this example, we have a setting called &#8220;MySetting&#8221; with the value &#8220;Hello, world!&#8221; and a connection string named &#8220;DefaultConnection.&#8221; Now, let&#8217;s see how we can access these values in our .NET Core application.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Accessing_appsettingsjson_values\"><\/span>Accessing appsettings.json values<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To access values from appsettings.json, we need to utilize the <code>IConfiguration<\/code> interface provided by .NET Core. This interface acts as a bridge between our application and the configuration settings. To get started, add a reference to the <code>Microsoft.Extensions.Configuration<\/code> namespace in your code file.<\/p>\n<p>Next, inject the <code>IConfiguration<\/code> interface into your class. Let&#8217;s say we have a class named &#8220;MyClass&#8221; that requires retrieving settings:<\/p>\n<p>&#8220;`csharp<br \/>\nusing Microsoft.Extensions.Configuration;<\/p>\n<p>public class MyClass<br \/>\n{<br \/>\n    private readonly IConfiguration _configuration;<\/p>\n<p>    public MyClass(IConfiguration configuration)<br \/>\n    {<br \/>\n        _configuration = configuration;<br \/>\n    }<\/p>\n<p>    public void DoSomethingWithSettings()<br \/>\n    {<br \/>\n        \/\/ Retrieve values from appsettings.json using IConfiguration instance<br \/>\n    }<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p>Now, to retrieve the values from appsettings.json, you can use the <code>GetValue<\/code> method provided by the <code>IConfiguration<\/code> interface:<\/p>\n<p>&#8220;`csharp<br \/>\npublic void DoSomethingWithSettings()<br \/>\n{<br \/>\n    string mySetting = _configuration.GetValue<string>(&#8220;MySetting&#8221;);<br \/>\n    string connectionString = _configuration.GetConnectionString(&#8220;DefaultConnection&#8221;);<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p>By providing the appropriate key, you can retrieve values of any type specified in appsettings.json.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_get_value_from_appsettingsjson_in_NET_Core\"><\/span>How to get value from appsettings.json in .NET Core?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>To get a value from appsettings.json in .NET Core, inject the IConfiguration interface into your class and use the GetValue or GetConnectionString method to retrieve the desired setting.<\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions_FAQs\"><\/span>Frequently Asked Questions (FAQs)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"1_Can_I_have_multiple_appsettingsjson_files\"><\/span>1. Can I have multiple appsettings.json files?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, you can have multiple appsettings.json files to organize settings based on different environments. For example, you can have appsettings.json, appsettings.Development.json, appsettings.Production.json, etc., and they will be automatically loaded based on the environment.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_How_to_load_settings_from_a_specific_appsettings_file\"><\/span>2. How to load settings from a specific appsettings file?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nTo load settings from a specific appsettings file, you can specify the environment when building the configuration in your application&#8217;s entry point, like so: <code>builder.AddJsonFile(\"appsettings.json\", optional: true, reloadOnChange: true)<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"3_Can_I_use_a_different_name_for_the_appsettings_file\"><\/span>3. Can I use a different name for the appsettings file?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, you can change the name of the appsettings file. When building the configuration, simply provide the desired filename, like: <code>builder.AddJsonFile(\"customsettings.json\", optional: true, reloadOnChange: true)<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"4_Can_I_store_sensitive_information_in_appsettingsjson\"><\/span>4. Can I store sensitive information in appsettings.json?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nWhile appsettings.json can be used to store settings, it is not recommended for storing sensitive data like passwords or access tokens. Consider using a more secure approach, such as Azure Key Vault or user secrets, for sensitive information.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"5_How_to_bind_appsettings_values_to_a_strongly-typed_class\"><\/span>5. How to bind appsettings values to a strongly-typed class?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nTo bind appsettings values to a strongly-typed class, you can use the <code>Configure<\/code> method along with the <code>Bind<\/code> extension method. For example: <code>services.Configure<MyOptions>(Configuration.GetSection(\"MyOptions\"))<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"6_How_to_reload_appsettingsjson_without_restarting_the_application\"><\/span>6. How to reload appsettings.json without restarting the application?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nBy setting <code>reloadOnChange: true<\/code> when loading the appsettings.json file, any changes made to the file will automatically trigger a reload of the configuration without requiring a restart.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"7_Can_I_access_the_configuration_values_in_a_static_class\"><\/span>7. Can I access the configuration values in a static class?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, you can access the configuration values in a static class. Simply pass the IConfiguration instance as a parameter to the static method, and you can retrieve the values as usual.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"8_Can_I_use_dependency_injection_in_appsettingsjson\"><\/span>8. Can I use dependency injection in appsettings.json?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nNo, you cannot directly use dependency injection in appsettings.json. Appsettings.json is primarily for storing configuration values, and if you require dependency injection, it should be handled through the appropriate application components.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"9_Can_I_specify_default_values_for_appsettings_values\"><\/span>9. Can I specify default values for appsettings values?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nYes, you can specify default values for appsettings values using the <code>GetValue<\/code> method. Simply provide the default value as the second parameter, like so: <code>string mySetting = _configuration.GetValue(\"MySetting\", \"Default value\")<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"10_How_can_I_access_nested_settings_in_appsettingsjson\"><\/span>10. How can I access nested settings in appsettings.json?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nTo access nested settings in appsettings.json, you can separate the keys using a colon (&#8220;:&#8221;). For example, <code>string nestedSetting = _configuration.GetValue(\"ParentKey:ChildKey\")<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"11_How_can_I_access_values_from_environment_variables\"><\/span>11. How can I access values from environment variables?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nIn addition to appsettings.json, you can access values from environment variables using <code>Environment.GetEnvironmentVariable(\"KeyName\")<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"12_Can_I_modify_appsettingsjson_at_runtime\"><\/span>12. Can I modify appsettings.json at runtime?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\nModifying appsettings.json at runtime is discouraged. Instead, consider using a combination of environment variables and external configuration providers to alter settings without modifying the file directly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In .NET Core, the appsettings.json file plays a vital role in storing application settings. It allows developers to separate configuration from code, making it easier to modify settings without redeploying the application. Retrieving values from appsettings.json is a common requirement, and fortunately, it&#8217;s straightforward to accomplish in .NET Core. The appsettings.json file Before we dive &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to get value from appsettings.json in .NET Core?\" class=\"read-more button\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#more-227928\">Read more<span class=\"screen-reader-text\">How to get value from appsettings.json in .NET Core?<\/span><\/a><\/p>\n","protected":false},"author":57,"featured_media":107420,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86279],"tags":[],"class_list":["post-227928","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to get value from appsettings.json in .NET Core?<\/title>\n<meta name=\"description\" content=\"In .NET Core, the appsettings.json file plays a vital role in storing application settings. It allows developers to separate configuration from code,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to get value from appsettings.json in .NET Core?\" \/>\n<meta property=\"og:description\" content=\"In .NET Core, the appsettings.json file plays a vital role in storing application settings. It allows developers to separate configuration from code,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/\" \/>\n<meta property=\"og:site_name\" content=\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/synchronyfinancial\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-18T11:13:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Casey Mayer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@synchrony\" \/>\n<meta name=\"twitter:site\" content=\"@synchrony\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Casey Mayer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/\"},\"author\":{\"name\":\"Casey Mayer\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/89e431077ef417dfaa131f435124f18f\"},\"headline\":\"How to get value from appsettings.json in .NET Core?\",\"datePublished\":\"2024-07-18T11:13:20+00:00\",\"dateModified\":\"2024-07-18T11:13:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/\"},\"wordCount\":752,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"articleSection\":[\"Learn\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/\",\"name\":\"How to get value from appsettings.json in .NET Core?\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\"},\"datePublished\":\"2024-07-18T11:13:20+00:00\",\"dateModified\":\"2024-07-18T11:13:20+00:00\",\"description\":\"In .NET Core, the appsettings.json file plays a vital role in storing application settings. It allows developers to separate configuration from code,\",\"breadcrumb\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/namso-gen.co\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to get value from appsettings.json in .NET Core?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"description\":\"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co\",\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/namso-gen.co\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"contentUrl\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"width\":500,\"height\":164,\"caption\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\"},\"image\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/synchronyfinancial\",\"https:\/\/twitter.com\/synchrony\",\"https:\/\/www.youtube.com\/synchronyfinancial\",\"https:\/\/www.instagram.com\/synchrony\",\"https:\/\/www.linkedin.com\/company\/synchrony-financial\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/89e431077ef417dfaa131f435124f18f\",\"name\":\"Casey Mayer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"Casey Mayer\"},\"description\":\"Guest author Casey Mayer has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to get value from appsettings.json in .NET Core?","description":"In .NET Core, the appsettings.json file plays a vital role in storing application settings. It allows developers to separate configuration from code,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/","og_locale":"en_US","og_type":"article","og_title":"How to get value from appsettings.json in .NET Core?","og_description":"In .NET Core, the appsettings.json file plays a vital role in storing application settings. It allows developers to separate configuration from code,","og_url":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/","og_site_name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","article_publisher":"https:\/\/www.facebook.com\/synchronyfinancial","article_published_time":"2024-07-18T11:13:20+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png","type":"image\/png"}],"author":"Casey Mayer","twitter_card":"summary_large_image","twitter_creator":"@synchrony","twitter_site":"@synchrony","twitter_misc":{"Written by":"Casey Mayer","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#article","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/"},"author":{"name":"Casey Mayer","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/89e431077ef417dfaa131f435124f18f"},"headline":"How to get value from appsettings.json in .NET Core?","datePublished":"2024-07-18T11:13:20+00:00","dateModified":"2024-07-18T11:13:20+00:00","mainEntityOfPage":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/"},"wordCount":752,"commentCount":0,"publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"articleSection":["Learn"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/","url":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/","name":"How to get value from appsettings.json in .NET Core?","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/#website"},"datePublished":"2024-07-18T11:13:20+00:00","dateModified":"2024-07-18T11:13:20+00:00","description":"In .NET Core, the appsettings.json file plays a vital role in storing application settings. It allows developers to separate configuration from code,","breadcrumb":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/namso-gen.co\/blog\/how-to-get-value-from-appsettings-json-in-net-core\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/namso-gen.co\/blog\/"},{"@type":"ListItem","position":2,"name":"How to get value from appsettings.json in .NET Core?"}]},{"@type":"WebSite","@id":"https:\/\/namso-gen.co\/blog\/#website","url":"https:\/\/namso-gen.co\/blog\/","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","description":"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co","publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/namso-gen.co\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/namso-gen.co\/blog\/#organization","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","url":"https:\/\/namso-gen.co\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","contentUrl":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","width":500,"height":164,"caption":"Namso Gen Blog - Free Credit Card Generator [100% Valid]"},"image":{"@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/synchronyfinancial","https:\/\/twitter.com\/synchrony","https:\/\/www.youtube.com\/synchronyfinancial","https:\/\/www.instagram.com\/synchrony","https:\/\/www.linkedin.com\/company\/synchrony-financial"]},{"@type":"Person","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/89e431077ef417dfaa131f435124f18f","name":"Casey Mayer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"Casey Mayer"},"description":"Guest author Casey Mayer has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here."}]}},"_links":{"self":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/227928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/users\/57"}],"replies":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/comments?post=227928"}],"version-history":[{"count":0,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/227928\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media\/107420"}],"wp:attachment":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media?parent=227928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/categories?post=227928"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/tags?post=227928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}