public
partial
class
_Default : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
int
[][] num =
new
int
[][]{
new
int
[] { 1, 2 },
new
int
[]{ 3, 4 } };
Label1.Text = ToJson<
int
[][]>(num)
}www.butiankj.com
public
static
string
ToJson<T>(T obj)
{
DataContractJsonSerializer j =
new
DataContractJsonSerializer(
typeof
(T));
MemoryStream ms =
new
MemoryStream();
j.WriteObject(ms, obj);
return
Encoding.Default.GetString(ms.ToArray());
}
}