using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Json;
namespace StackOverflowQuestion
{
class StackOverflowQuestion
{
public StackOverflowQuestion()
{
JsonObject jsonObj = new JsonObject();
string[] arr = { "first_value", "second_value", "third_value" };
obj.Add("array", arr); // Compiler cannot convert string[] to System.Json.JsonValue
}
}
}
我想收到的结果JSON对象像如何将数组(字符串[])转换为JsonValue?
{"array":["first_value","second_value","third_value"]"}
不要使用JavaScriptSerializer。已经过时了。微软本身使用Json.NET –