Skip to content

Formatted Json escapes non-ASCII characters in Dashboard #9763

Open
@Victor-johnsson

Description

@Victor-johnsson

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hello!

When I serialize an object with System.Text.Json using

var options = new JsonSerializerOptions
{
  WriteIndented = true,
  Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
};
var json = JsonSerializer.Serialize(record, options);
logger.LogInformation("Unicode characters: {unicode}", json);

I expect the log entry parameter 'unicode' to contain the raw characters (åäöÅÄÖ) in the Aspire Dashboard.
Instead when viewing the Format JSON in the Aspire Dashboard it shows them as \u00E5\u00E4\u00F6\u00C5\u00C4\u00D6.

Image

The unformatted view show the raw characters.

Expected Behavior

I expect the Format JSON view in the Dashboard to show raw characters for non-ASCII characters, when logging a serialized object.

Steps To Reproduce

I've created a minimalistic aspire project here!

When starting the program, just browse to the Api project. This will log out a the json string of a serialized object with some Swedish characters.

The endpoint is "/".

Exceptions (if any)

No response

.NET Version info

.NET SDK:
Version: 9.0.203
Commit: dc7acfa194
Workload version: 9.0.200-manifests.5063bca7
MSBuild version: 17.13.20+a4ef1e90f

Runtime Environment:
OS Name: ubuntu
OS Version: 24.04
OS Platform: Linux
RID: linux-x64
Base Path: /home/victor/.dotnet/sdk/9.0.203/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.4
Architecture: x64
Commit: f57e6dc747

.NET SDKs installed:
8.0.404 [/home/victor/.dotnet/sdk]
8.0.407 [/home/victor/.dotnet/sdk]
9.0.100 [/home/victor/.dotnet/sdk]
9.0.200 [/home/victor/.dotnet/sdk]
9.0.202 [/home/victor/.dotnet/sdk]
9.0.203 [/home/victor/.dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.10 [/home/victor/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [/home/victor/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.13 [/home/victor/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.14 [/home/victor/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [/home/victor/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.2 [/home/victor/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.3 [/home/victor/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.4 [/home/victor/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.10 [/home/victor/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [/home/victor/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.13 [/home/victor/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.14 [/home/victor/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [/home/victor/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.2 [/home/victor/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.3 [/home/victor/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.4 [/home/victor/.dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_ROOT [/home/victor/.dotnet]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Anything else?

I'm not sure if this is considered a bug or if this is how it is intended to work! But stumbled on it when trying to log some serialized objects which contained Swedish characters such as åäö!

Other info:
I'm running this via the aspire cli, in ubuntu 24.04.01 running in WSL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions