{"id":18016069,"url":"https://github.com/thevpc/tson","last_synced_at":"2025-07-07T21:32:30.332Z","repository":{"id":73363639,"uuid":"333213182","full_name":"thevpc/tson","owner":"thevpc","description":"Typed \u0026 Smart Object Notation","archived":false,"fork":false,"pushed_at":"2025-03-21T14:43:43.000Z","size":2117,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T15:30:33.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thevpc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-26T20:47:57.000Z","updated_at":"2025-03-21T14:43:47.000Z","dependencies_parsed_at":"2024-05-19T18:31:16.069Z","dependency_job_id":"aeff9760-fefd-4d41-815c-73761589875f","html_url":"https://github.com/thevpc/tson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevpc%2Ftson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevpc%2Ftson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevpc%2Ftson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevpc%2Ftson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thevpc","download_url":"https://codeload.github.com/thevpc/tson/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245712778,"owners_count":20660294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T04:15:57.856Z","updated_at":"2025-07-07T21:32:30.326Z","avatar_url":"https://github.com/thevpc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tson\nType Safe Object Notation\n\n``tson`` (read Tyson) is a comprehensive, json-like format, that supports out of the box several simple and complex types.\n``tson`` is ideal as a configuration format but can also be used as for communication (serialization).\n\nSupported features include :\n* string, single line/multiline\n* null values and boolean type\n* byte, short, int, long and bigint types\n* float, double, bigdecimal types\n* arrays, objects (maps)\n* complex types (float, double and bigdecimal based complex values)\n* arrays and matrices (of any other type)\n* named arrays, parametrized arrays\n* named objects, parametrized objects\n* pairs (key/value)\n* uplets\n* names uplets (aka functions)\n* annotations\n* expressions with standard operators (+,-,*...)\n* comments\n\n\n# Rationale\nWhy not JSON. Well json does not support type safe primitives and is very limited. For instance it does not even support comments.\nWhy not YAML. YAML is a superset of json. So is ``tson``, however, unlike yaml, tson does not support space based syntax and hence \nis less error prone. Besides, ``tson`` is ways more comprehensive and support ways more types and features.\n``tson`` is also more user friendly with support of multiline strings, regular expressions, numeric values with units (think of 3GHz for three Giga Hertz for instance), \ncomplex values, and so on.\n\n# Some Examples\nThe following is tson example\n\n```tson\n// this is comment that prefixes a tson object\n// tson object are very similar to json objects \n{\n    /* an object entry can be anything, not only pairs*/\n    name:\"some name\"\n    // annotation can be applied to anything\n    @ThisIsMyAnnotation(something)\n    short-observation:  ¶ this is a string that ends by line carriage\n    long-observation: \"\"\"\n                       this is a multiline string\n                      \"\"\"\n    weight : 12.3kg  // this is a double number with 'kg' suffix \n    full   : 3L%     // this is long number with '%' suffix \n    // tson object can also include non pair value like a number \n    3.141592\n    // objects can also be named (prefixed by a name)\n    parent: item{\n        (): \"empty Uplet\"\n        (1): \"singleton\"\n    }\n    // objects can also be parametrized\n    parent: item(name:\"new item\"){\n        (): \"empty Uplet\"\n        (1): \"singleton\"\n    }\n    // as does arrays\n    someArray: item(name:\"new item\")[\n        (): \"empty Uplet\"\n        \"second item\"\n        \"third item\"\n    ]\n}\n```\n\n\n\nThe simplest ``tson`` file may contain a single literal, such as\n\n```tson\n12\n```\nor even a bar null value\n```tson\nnull\n```\n\n``tson`` file may contain a more complex value such as\n\n```tson\n{\n    name:\"some name\",\n    value:12.3,\n}\n```\n\n\n# Elements\n## Primitive types\n\n```\n    Byte       : 12b ,  -12B ,  0x12b,  0x12B,  012b,  0b011001b,  0b011001B\n    Short      : 12s ,  -12S ,  0x12s,  0x12s,  012s,  0b011001s,  0b011001S\n    Int        : 120 ,  -122 ,  0x123,  0x120,  0123,  0b0110011,  0b0110001\n    Long       : 12L ,  -12L ,  0x12L,  0x12L,  012L,  0b011001L,  0b011001L\n(*) BigInt     : 12G ,  -12G ,  0x12G,  0x12G,  012G,  0b011001G,  0b011001G\n    Float      : 1.0f,  -1.2E-3F\n    Double     : 1.0 ,  -1.2E-3 NaN -Inf +Inf +Bound -Bound\n(*) Decimal    : 1.0d ,  -1.2E-3D\n(*) BigDecimal : 1.0c ,  -1.2E-3c\n    time       : 12:11:00\n    date       : 2022-12-11\n    datetime   : 2022-12-11 12:11:00\n    boolean    : true, false\n    null       : null\n```\n\n## Strings\n\n```\n    string          : \"Hello\\n\"\n    char            : 'a'\n    simple string   : 'some string'\n    regexp          : /a*/\n    multiline string: \"\"\"\n                    some string\n                    \"\"\"\n```\n\n\n## Array\n\n```\n    array          :   [12, 13]\n\n    named array    :   someName[\n                            12,\n                            a:13\n                            (1,2):[1, 2, 3]\n                        ]\n\n    named function array    : \n                        someName(a,b,c)[\n                            12,\n                            a:13\n                            (1,2):[1, 2, 3]\n                        ]\n                        \n```\n\n## Uplet\n```\n    (12, 13)\n```\n\n## Objects\n```\n   object            : {\n                            12,\n                            a:13\n                            (1,2):[1, 2, 3]\n                        }\n   named object      : someName{\n                            12,\n                            a:13\n                            (1,2):[1, 2, 3]\n                        }\n   named function object   : \n                    someName(a,b,c){\n                            12,\n                            a:13\n                            (1,2):[1, 2, 3]\n                        }\n```\n\n\n## Annotation\n```\n    @someAnnotation(a,b,c)\n    someName(a,b,c){\n        12,\n        a:13\n        (1,2):[1, 2, 3]\n    }\n```\n\n## Char Stream\n\n```\n    ^SomeDelimiter[ Anything you cna think of]SomeDelimiter\n```\n\n## Binary Stream\n\n```\n    ^SomeDelimiter[Base64]SomeDelimiter\n```\n\n## Alias\n\n```\n    {\n        a: @(#ref)1234\n        b:\u0026ref\n    }\n```\n\n## Comments\n\n```\n    {  /* \n            this is a comment \n       */\n        a:1234\n        b:\u0026a\n    }\n```\n\n## Expressions\n\n```\n    a+1\n    a=1\n    a:=1\n    a\u003c=1\n    a==\u003e1\n    a**1\n    a^1    \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthevpc%2Ftson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthevpc%2Ftson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthevpc%2Ftson/lists"}