Path: redb/redb.PropsEditor/Components/JsonEditor.razor
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/JsonEditor.razor
----
@using Microsoft.FluentUI.AspNetCore.Components
@* Fallback JSON editor for complex types *@
@if (!string.IsNullOrEmpty(errorMessage))
{
@errorMessage
}
@code {
[Parameter]
public string Value { get; set; } = "";
[Parameter]
public EventCallback OnValueChanged { get; set; }
[Parameter]
public bool IsReadOnly { get; set; }
private string? errorMessage;
private async Task HandleChange(string value)
{
errorMessage = null;
// Validate JSON
try
{
System.Text.Json.JsonDocument.Parse(value);
await OnValueChanged.InvokeAsync(value);
}
catch (System.Text.Json.JsonException ex)
{
errorMessage = $"Invalid JSON: {ex.Message}";
}
}
}