在C#Winforms应用程序中使用JSON

时间:2022-11-17 20:58:06

So I am making an application in C# to read some information from the web, but it is a windows forms application. I get a JSON string, and I need to get some information from it. I know there is a library for that for C# web applications, but how can I use in in my windows forms application?

所以我在C#中创建一个应用程序来从Web上读取一些信息,但它是一个Windows窗体应用程序。我得到一个JSON字符串,我需要从中获取一些信息。我知道有一个用于C#Web应用程序的库,但是如何在我的Windows窗体应用程序中使用?

2 个解决方案

#1


12  

There are many JSON libraries out there. Here are three suggestions that you could look into:

那里有很多JSON库。以下是您可以查看的三个建议:

  • Json.NET, a fairly popular library for JSON (de-)serialization.

    Json.NET,一个非常流行的JSON(反)序列化库。

  • ServiceStack's JsonSerializer, according to a comparison in this ServiceStack blog currently the fastest JSON (de-)serializer.

    根据ServiceStack博客目前最快的JSON(反)序列化器的比较,ServiceStack的JsonSerializer。

  • I believe the .NET 4 Framework might also have JSON serialization (in the System.Runtime.Serialization.Json namespace from the System.Runtime.Serialization.dll assembly; the namespace seems to have been available in .NET 3.5, but in a different assembly), but I've never looked at it closely.

    我相信.NET 4 Framework也可能有JSON序列化(在System.Runtime.Serialization.dll程序集的System.Runtime.Serialization.Json命名空间中;命名空间似乎在.NET 3.5中可用,但在不同的虽然我从未仔细研究过它。

#2


-4  

JSON.NET is useless for VS2012 b/c the nuget packages of JSON.NET are broken for nuget 2.8 and VS2012 cannot get anything newer than nuget 2.8!

JSON.NET对于VS2012 b / c来说是无用的,JSON.NET的nuget包对于nuget 2.8而言是破坏的,而VS2012无法获得比nuget 2.8更新的东西!

#1


12  

There are many JSON libraries out there. Here are three suggestions that you could look into:

那里有很多JSON库。以下是您可以查看的三个建议:

  • Json.NET, a fairly popular library for JSON (de-)serialization.

    Json.NET,一个非常流行的JSON(反)序列化库。

  • ServiceStack's JsonSerializer, according to a comparison in this ServiceStack blog currently the fastest JSON (de-)serializer.

    根据ServiceStack博客目前最快的JSON(反)序列化器的比较,ServiceStack的JsonSerializer。

  • I believe the .NET 4 Framework might also have JSON serialization (in the System.Runtime.Serialization.Json namespace from the System.Runtime.Serialization.dll assembly; the namespace seems to have been available in .NET 3.5, but in a different assembly), but I've never looked at it closely.

    我相信.NET 4 Framework也可能有JSON序列化(在System.Runtime.Serialization.dll程序集的System.Runtime.Serialization.Json命名空间中;命名空间似乎在.NET 3.5中可用,但在不同的虽然我从未仔细研究过它。

#2


-4  

JSON.NET is useless for VS2012 b/c the nuget packages of JSON.NET are broken for nuget 2.8 and VS2012 cannot get anything newer than nuget 2.8!

JSON.NET对于VS2012 b / c来说是无用的,JSON.NET的nuget包对于nuget 2.8而言是破坏的,而VS2012无法获得比nuget 2.8更新的东西!