@page "/CSTJTest" @using System.Text.Json @using System.Text.Json.Nodes @using LibMatrix.Extensions Counter

Canonicalise JSON



@JsonOutput
@code { private string _jsonInput = ""; private string JsonInput { get => _jsonInput; set { _jsonInput = value; try { Console.WriteLine("Input updated"); var obj = JsonSerializer.Deserialize(value); Console.WriteLine("Deserialised"); JsonOutput = CanonicalJsonSerializer.Serialize(obj); Console.WriteLine("Serialised: " + JsonOutput ?? "null"); } catch (Exception e) { JsonOutput = e.ToString(); } StateHasChanged(); } } private string? JsonOutput { get; set; } }