小编use*_*792的帖子

C# 将 JSON 文件反序列化为数组

如何在 C# 中将 JSON 反序列化为数组,我想创建具有 JSON 属性的图像。我当前的JSON 文件看起来像这样......

{
  "test":[
    {
      "url":"150.png",
      "width":"300",
      "height":"300"
    },
    {
      "url":"150.png",
      "width":"300",
      "height":"300"
    },
    {
      "url":"150.png",
      "width":"300",
      "height":"300"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

我的 Form1 有一个 Picture1,我试图用 Newtonsoft.json 反序列化,但我不知道如何将我的 JSON 对象反序列化为数组。(我是开发初学者)

这是我当前的 Form1 代码

using System;
using System.Windows.Forms;
using System.Collections.Generic;

using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.IO;
using System.Linq;
using System.Drawing;

namespace viewer_mvc
{

    public partial class Index : Form
    {
        string url;
        int width, height;

        public Index()
        {
            InitializeComponent();
        }

        private void …
Run Code Online (Sandbox Code Playgroud)

c# serialization json converters toarray

0
推荐指数
1
解决办法
4461
查看次数

标签 统计

c# ×1

converters ×1

json ×1

serialization ×1

toarray ×1