最終更新:2012-08-08 (水) 18:54:38 (2679d)  

ServiceStack.Text はてなブックマークを見る
Top / ServiceStack.Text

The Home of .NET's fastest JSON, JSV? and CSV Text Serializers.

https://github.com/ServiceStack/ServiceStack.Text

JSV (JSON-like Separated Values)

コンポーネント

  • ServiceStack.JsonSerializer?
  • ServiceStack.CsvSerializer?
  • ServiceStack.TypeSerializer?

拡張メソッド

  • ToJson? - JSON
  • ToJsv? - JSV?
  • ToXml? - XML
  • Dump? - 見やすいように改行とかインデントが入る。

オーバーライド

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ServiceStack.Text;

namespace ServiceStackTextTest
{

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var test = new TestPOCO { Name = "ほげ", Detail = "ふが" };

            var json = JsonSerializer.SerializeToString(test);
            MessageBox.Show(test.ToJson());
            MessageBox.Show(json);

        }
    }

    class TestPOCO
    {
        public string Name { get; set; }
        public string Detail { get; set; }
    }

}

関連