Fix formula export casing: use camelCase to match import property lookups
System.Text.Json defaults to PascalCase for anonymous types, producing
"Name"/"OutputMode" etc., while the import used TryGetProperty("name")
causing every template to fail with "no name". Adding CamelCase naming
policy aligns the export format with what the import expects.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3073,7 +3073,11 @@ public class CompanySettingsController : Controller
|
|||||||
};
|
};
|
||||||
|
|
||||||
var json = System.Text.Json.JsonSerializer.Serialize(export,
|
var json = System.Text.Json.JsonSerializer.Serialize(export,
|
||||||
new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
|
new System.Text.Json.JsonSerializerOptions
|
||||||
|
{
|
||||||
|
WriteIndented = true,
|
||||||
|
PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase
|
||||||
|
});
|
||||||
var filename = $"formula-templates-{DateTime.UtcNow:yyyyMMdd}.json";
|
var filename = $"formula-templates-{DateTime.UtcNow:yyyyMMdd}.json";
|
||||||
return File(System.Text.Encoding.UTF8.GetBytes(json), "application/json", filename);
|
return File(System.Text.Encoding.UTF8.GetBytes(json), "application/json", filename);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user