C#的JSON开发包 LitJSON

码农软件 · 软件分类 · JSON/BSON开发包 · 2019-04-01 18:43:56

软件介绍

LitJSON 是一个小型快速的用于处理 JSON 格式数据的 C# 和 .NET 的开发包。

示例代码:

using LitJson;
using System;

public class Person
{
    // Person members are defined here ...
}

public class JsonSample
{
    public static void Main ()
    {
        PersonToJson ();
        JsonToPerson ();
    }

    public static void PersonToJson ()
    {
        Person bill = new Person ();

        bill.Name = "William Shakespeare";
        bill.Age  = 51;
        bill.Birthday = new DateTime (1564, 4, 26);

        string json_bill = JsonMapper.ToJson (bill);

        Console.WriteLine (json_bill);
        // {"Name":"William Shakespeare","Age":51,"Birthday":"04/26/1564 00:00:00"}
    }

    public static void JsonToPerson ()
    {
        string json = @"
            {
                ""Name""     : ""Thomas More"",
                ""Age""      : 57,
                ""Birthday"" : ""02/07/1478 00:00:00""
            }";

        Person thomas = JsonMapper.ToObject<Person> (json);

        Console.WriteLine ("Thomas' age: {0}", thomas.Age);
        // Thomas' age: 57
    }
}

本文地址:https://codercto.com/soft/d/2646.html

松本行弘的程式世界

松本行弘的程式世界

松本行弘 / 鄧瑋敦 / 博碩 / 2010年07月27日

讓Ruby之父教您大師級的程式思考術! 本書以松本行弘先生對程式本質的深層認知、各種技術之優缺點的掌握,闡述Ruby這套程式語言的設計理念,並由此延伸讓您一窺程式設計的奧妙之處。本書內含許多以Ruby、Lisp、Smalltalk、Erlang、JavaScript等動態語言所寫成的範例,從動態語言、函數式程式設計等領域開展您的學習視野。 本書精華: ‧物件導向與抽象化 ‧......一起来看看 《松本行弘的程式世界》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具