首页 > 解决方案 > Visual Studio 代码调试器出错命名空间“System.Text”中不存在类型或命名空间名称“Json”

问题描述

.NET Core 3.1 有一个新的 apiSystem.Text.Json来将对象序列化为 json

请参阅https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to?pivots=dotnet-core-3-1

我打电话System.Text.Json.JsonSerializer.Serialize(routeValues),但有错误

error CS0234: The type or namespace name 'Json' does not exist in the namespace 'System.Text' (are you missing an assembly reference?)

有谁知道这是什么?

我的 .NET SDK 版本是3.1.302

运行时环境:操作系统名称:Mac OS X 操作系统版本:10.15 操作系统平台:Darwin RID:osx.10.15-x64

在此处输入图像描述

标签: c#json.net-coreserialization

解决方案


推荐阅读