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 –