diff --git a/CodeBeam.MudBlazor.Extensions/Components/JsonTreeView/MudJsonTreeViewNode.razor b/CodeBeam.MudBlazor.Extensions/Components/JsonTreeView/MudJsonTreeViewNode.razor index 65fd6835..a744e506 100644 --- a/CodeBeam.MudBlazor.Extensions/Components/JsonTreeView/MudJsonTreeViewNode.razor +++ b/CodeBeam.MudBlazor.Extensions/Components/JsonTreeView/MudJsonTreeViewNode.razor @@ -34,8 +34,18 @@ } break; case JsonValueKind.Number: - var number = child.Value.AsValue().GetValue(); - + JsonValue jsonVal = child.Value.AsValue(); + string endText = string.Empty; + @* We try for int first, because an int can always be converted to double but not the other way around*@ + if (jsonVal.TryGetValue(out int intVal)) + { + endText = intVal.ToString(); + } + else if (jsonVal.TryGetValue(out double doubleVal)) + { + endText = doubleVal.ToString(); + } + break; case JsonValueKind.True: