Skip to content
/ tson Public

A format like JSON, except now with embedded types!

License

Notifications You must be signed in to change notification settings

miou-gh/tson

Repository files navigation

tson

Nuget License: MIT

Description

TSON is a human-readable data interchange format with a syntax similar to JSON. TSON preserves type information for every value.

TSON supports POCO serialization/deserialization. You can configure them using the TsonProperty and TsonIgnore attributes. A configuration object can also be passed in to the serialization and deserialization methods. Common usage example: To include private members during serialization.

Example

{
    "name": string("My Cool Adventure"),
    "plays": uint(150),
    "reputation": int(-2),
    "visible": bool(false),
    "data": bytes("UTIHCQsOEBIUFxkbHSAiJCYHCQsOEBIUFxkbHSAiJCYICAg="),
    "created": datetime("2020-05-13T10:06:09.5137659-04:00")
}
// serialize an object into a TSON string.
var serialized = TsonConvert.Serialize(input, Formatting.Indented);

// deserialize a TSON string into a Dictionary<string, object>
var deserialized = TsonConvert.Deserialize(input);

// deserialize a TSON string into a class.
var deserialized = TsonConvert.Deserialize<ShopItems>();

Supported Types

  • Object
  • Array
  • Literals
    • string
    • bool
    • int
    • uint
    • long
    • ulong
    • char
    • short
    • ushort
    • float
    • double
    • sbyte
    • byte
    • bytes
    • null
    • datetime
    • uri

About

A format like JSON, except now with embedded types!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages