#16615·abp

why not work json sub root IStringLocalizer?

Author: Kamran-KarimiCreated May 22, 2023Updated Sep 3, 2026
Labelsfeature

It is possible that the JSON sub root is not working due to incorrect configuration or implementation of IStringLocalizer with JSON files. Here are some possible reasons why it may not be working.

file en.json :

{
 "culture": "en",
  "texts": {
   {
     "Order": {
      "Total": "About Us",
      "Product": {
        "Name" : "Mobile",
        "Code" : "Code sku",
      }
    },
    "Home": {
       "Title": "Home Page",
       "Description": "This is the home page."
     }
   }
  }
}
<label>@L["Order.Product.Name"]</label>
<label>@L["Order.Product.Code"]</label>

Error system : 'Can not parse json string. The JSON value could not be converted to System.String. Path: $.texts.Class | LineNumber: 6 | BytePositionInLine: 14.

So please add this code to abp.framework update version next for suport root json keys : https://codewithmukesh.com/blog/json-based-localization-in-aspnet-core/ Or https://stackoverflow.com/questions/43615912/asp-net-core-localization-with-json-files

And Sample code in cshtml:

<label>@L["Order.Product.Name"]</label>
<label>@L["Order.Product.Code"]</label>

This work .