{"id":19432218,"url":"https://github.com/gebrkn/slon","last_synced_at":"2026-05-14T22:03:40.748Z","repository":{"id":57363299,"uuid":"198802069","full_name":"gebrkn/slon","owner":"gebrkn","description":"Simple Lightweight Object Notation","archived":false,"fork":false,"pushed_at":"2020-07-29T21:37:48.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T21:57:34.763Z","etag":null,"topics":["json","serialization"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gebrkn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-25T09:35:53.000Z","updated_at":"2020-07-29T21:37:50.000Z","dependencies_parsed_at":"2022-09-06T09:40:53.084Z","dependency_job_id":null,"html_url":"https://github.com/gebrkn/slon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gebrkn/slon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebrkn%2Fslon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebrkn%2Fslon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebrkn%2Fslon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebrkn%2Fslon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gebrkn","download_url":"https://codeload.github.com/gebrkn/slon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebrkn%2Fslon/sbom","scorecard":{"id":421284,"data":{"date":"2025-08-11","repo":{"name":"github.com/gebrkn/slon","commit":"9325065a62f434ed4119697df94e818006727899"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/5 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-19T01:16:09.443Z","repository_id":57363299,"created_at":"2025-08-19T01:16:09.443Z","updated_at":"2025-08-19T01:16:09.443Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284964326,"owners_count":27091965,"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","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["json","serialization"],"created_at":"2024-11-10T14:35:02.612Z","updated_at":"2025-11-17T22:04:04.050Z","avatar_url":"https://github.com/gebrkn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slon\n\n`slon` is Simple Lightweight Object Notation. Like `json`, but with less punctuation and some smart features.\n\n###### slon:\n```\n// slon example\n\n{\n    name Shakespeare\n    first_name William\n\n    about \"\"\"\n        William Shakespeare was an English poet, playwright, and actor, \n        widely regarded as the greatest writer in the English language \n        and the world's greatest dramatist (Wikipedia)\n    \"\"\"\n    \n    books [\n        {  title Hamlet    price 12.34    onSale true }\n        {  title Macbeth   price 42.99    onSale false  }\n\n        /* sold out\n        { title \"The Comedy of Errors\" price 34.11 onSale no }\n        */\n    ]\n\n    locations {\n        Africa.Egypt.Alexandria Antony\n        Europe.Greece.Athens Timon\n        Europe.Italy.Venice  Othello\n        Europe.Italy.Verona  Romeo\n    }\n\n    readers [Alice Bob Carol]\n}\n```\n###### json:\n```\n{\n    \"name\": \"Shakespeare\",\n    \"first_name\": \"William\",\n    \"about\": \"William Shakespeare was an English poet, playwright, and actor,\\nwidely regarded as the greatest writer in the English language\\nand the world's greatest dramatist (Wikipedia)\",\n    \"books\": [\n        {\n            \"title\": \"Hamlet\",\n            \"price\": 12.34,\n            \"onSale\": true\n        },\n        {\n            \"title\": \"Macbeth\",\n            \"price\": 42.99,\n            \"onSale\": false\n        }\n    ],\n    \"locations\": {\n        \"Africa\": {\n            \"Egypt\": {\n                \"Alexandria\": \"Antony\"\n            }\n        },\n        \"Europe\": {\n            \"Greece\": {\n                \"Athens\": \"Timon\"\n            },\n            \"Italy\": {\n                \"Venice\": \"Othello\",\n                \"Verona\": \"Romeo\"\n            }\n        }\n    },\n    \"readers\": [\n        \"Alice\",\n        \"Bob\",\n        \"Carol\"\n    ]\n}\n```\n\n * [layout](#layout)\n * [values](#values)\n     * [null](#null)\n     * [numbers](#numbers)\n     * [booleans](#booleans)\n     * [strings](#strings)\n         * [plain strings](#plain-strings)\n         * [multiline strings](#multiline-strings)\n         * [bare strings](#bare-strings)\n     * [arrays](#arrays)\n     * [objects](#objects)\n * [advanced usage](#advanced-usage)\n     * [structured keys](#structured-keys)\n     * [hooks](#hooks)\n * [APIs](#apis)\n     * [python](#python)\n     * [javascript](#javascript)\n * [info](#info)\n\n\n## layout\n\n`slon` is a superset of `json`, that is, every valid `json` is also valid `slon`. Indentation is ignored, except within multiline strings. Array and object delimiters (commas/colons) are optional, object keys don't have to be quoted.\n\n`slon` supports line comments with `#` or `//` and C-style comment blocks `/* ... */`\n\n\n###### slon:\n```\n# sample data\n\n/*\n    @author: me\n    @date: today\n*/\n\n{\n    name Shakespeare // author's name\n    year 1564        // year of birth\n\n    books [Hamlet Macbeth Othello]\n\n    Alice: true,\n    Bob: true,\n    Carol: true,\n}\n```\n###### json:\n```\n{\n    \"name\": \"Shakespeare\",\n    \"year\": 1564,\n    \"books\": [\n        \"Hamlet\",\n        \"Macbeth\",\n        \"Othello\"\n    ],\n    \"Alice\": true,\n    \"Bob\": true,\n    \"Carol\": true\n}\n```\n\n## values\n\nOut of the box, `slon` can encode nulls, numbers, booleans, strings, arrays and objects.\n\n### null\n\nA `null` value is `null` or `none`, case-insensitive:\n\n###### slon:\n```\n[ null NULL None none ]\n```\n###### json:\n```\n[\n    null,\n    null,\n    null,\n    null\n]\n```\n\n### numbers\n\n`slon` supports decimal, hexadecimal, octal and binary integers and decimal floats in the standard notation. Unlike json, leading zeroes are allowed. A number can be preceded by a `-` or `+`. Underscores can be used to delimit long numbers.\n\n###### slon:\n```\n[\n    123\n    123_456_789\n    +045.990\n    -12.3e4\n    0xcafe\n    0o755\n    0b1110011\n]\n```\n###### json:\n```\n[\n    123,\n    123456789,\n    45.99,\n    -123000.0,\n    51966,\n    493,\n    115\n]\n```\n\n### booleans\n\nBoolean literals are `true`, `on`, `yes` for \"true\", `false`, `off`, `no` for \"false\", case-insensitive.\n\n###### slon:\n```\n{\n    select true\n    update YES\n    insert ON\n    delete no\n    create Off\n}\n```\n###### json:\n```\n{\n    \"select\": true,\n    \"update\": true,\n    \"insert\": true,\n    \"delete\": false,\n    \"create\": false\n}\n```\n\n### strings\n\n#### plain strings\n\nPlain strings are enclosed in single or double quotes and cannot contain a literal newline.\n\nSingle quoted strings are verbatim, that is, every symbol is interpreted exactly as written.\n\n###### slon:\n```\n'Hamlet \\xa9 William, 1599. \\n bravo \\U0001F44F \\u{1f44f}'\n```\n###### json:\n```\n\"Hamlet \\\\xa9 William, 1599. \\\\n bravo \\\\U0001F44F \\\\u{1f44f}\"\n```\n\nDouble quoted strings interpret these escape sequences:\n\n```\n\\n  \\r  \\t  \\b  \\f  \\\\  \\\"  \\'  \\/  \\\\  \\0\n```\n\nand unicode escapes in these formats:\n\n```\n\\x12  \\u1234  \\u{12345}  \\U00012345\n```\n\n###### slon:\n```\n\"Hamlet \\xa9 William, 1599. \\n bravo \\U0001F44F \\u{1f44f}\"\n```\n###### json:\n```\n\"Hamlet © William, 1599. \\n bravo 👏 👏\"\n```\n\n`slon` decodes valid unicode surrogate pairs into plane 1 characters:\n\n###### slon:\n```\n\"smile \\ud83d\\ude03\"\n```\n###### json:\n```\n\"smile 😃\"\n```\n\n`slon` doesn't allow unicode escapes greater than `\\u{10FFFF}`, but otherwise makes no attempt to validate unicode. Particularly, invalid surrogate pairs and non-characters are left as is.\n\n#### multiline strings\n\nStrings enclosed in triple quotes (`'''` or `\"\"\"`) or backticks can span across multiple lines.\n\nIf a character right after opening quotes is a space or a newline, newlines in the string are preserved, and the string is dedented to its minimal indent:\n\n###### slon:\n```\n\"\"\"\n            Scene I.        \n\n        BERNARDO\n            Who's there?\n        FRANCISCO\n            Nay, answer me: stand, and unfold yourself.\n\"\"\"\n```\n###### json:\n```\n\"    Scene I.\\n\\nBERNARDO\\n    Who's there?\\nFRANCISCO\\n    Nay, answer me: stand, and unfold yourself.\"\n```\n\nOtherwise, the string is \"compressed\", so that all whitespace sequences are reduced to a single space character:\n\n###### slon:\n```\n\"\"\"You are welcome, masters;\nwelcome, all.\n\nI am glad\nto see thee well.\n\"\"\"\n```\n###### json:\n```\n\"You are welcome, masters; welcome, all. I am glad to see thee well.\"\n```\n\n`'''` strings are verbatim, `\"\"\"` and backtick strings interpret the escape sequences. Note that escaped spaces or newlines are preserved when the string is dedented or compressed:\n\n###### slon:\n```\n`Enter a King\\n\nand a Queen very lovingly;\\n\nthe Queen embracing him,\\n\nand he her.`\n```\n###### json:\n```\n\"Enter a King\\n and a Queen very lovingly;\\n the Queen embracing him,\\n and he her.\"\n```\n\n#### bare strings\n\nAny sequence of symbols except whitespaces, punctuation and numeric/bool literals is considered a string, so you can write \"simple\" strings without any quotes at all:\n\n###### slon:\n```\n[\n    Hamlet\n    claudius@elsinore.castle\n    $123.45\n]\n```\n###### json:\n```\n[\n    \"Hamlet\",\n    \"claudius@elsinore.castle\",\n    \"$123.45\"\n]\n```\n\n### arrays\n\nAn array (aka list) is a sequence of values separated by commas or whitespaces, enclosed in `[...]`:\n \n###### slon:\n```\n[\n    Shakespeare\n    William\n    \"The Tragedy of Hamlet\" \n    [\n        2017,\n        2018,\n        2019,\n    ]\n]\n```\n###### json:\n```\n[\n    \"Shakespeare\",\n    \"William\",\n    \"The Tragedy of Hamlet\",\n    [\n        2017,\n        2018,\n        2019\n    ]\n]\n```\n\n### objects\n\nAn object (aka struct, dict) is a sequence of key-value pairs, separated by commas or whitespaces and enclosed in `{...}`. Keys and values are separated by colons or equal signs or whitespaces. Keys can be strings, integers or booleans:\n \n###### slon:\n```\n{\n    author\n        Shakespeare\n    year\n        1599\n    \"full title\": 'The Tragedy of Hamlet'\n    seasons {\n        2017 = yes\n        2018 = no\n        2019 = yes\n    } \n}\n```\n###### json:\n```\n{\n    \"author\": \"Shakespeare\",\n    \"year\": 1599,\n    \"full title\": \"The Tragedy of Hamlet\",\n    \"seasons\": {\n        \"2017\": true,\n        \"2018\": false,\n        \"2019\": true\n    }\n}\n```\n\n## advanced usage\n\n### structured keys\n\nAn object key which is a non-quoted (\"bare\") string can contain dots, in which case `slon` treats it as a structured (\"nested\") key and resolves intermediate objects or arrays, creating them on the fly if needed:\n\n###### slon:\n```\n{\n    title.short  Hamlet\n    \n    price { normal 12.34 }\n\n    price.sale\n        5.67\n    price.special.christmas   \n        8.99\n\n    readers.0.name Alice\n    readers.1.name Bob\n    readers.2.name Carol\n}\n```\n###### json:\n```\n{\n    \"title\": {\n        \"short\": \"Hamlet\"\n    },\n    \"price\": {\n        \"normal\": 12.34,\n        \"sale\": 5.67,\n        \"special\": {\n            \"christmas\": 8.99\n        }\n    },\n    \"readers\": [\n        {\n            \"name\": \"Alice\"\n        },\n        {\n            \"name\": \"Bob\"\n        },\n        {\n            \"name\": \"Carol\"\n        }\n    ]\n}\n```\n\nA `+` after a key means \"append to that array\":\n\n###### slon:\n```\n{\n    author Shakespeare\n    title Hamlet\n\n    readers+ { name Alice }\n    readers+ { name Bob }\n    readers+ { name Carol }\n}\n```\n###### json:\n```\n{\n    \"author\": \"Shakespeare\",\n    \"title\": \"Hamlet\",\n    \"readers\": [\n        {\n            \"name\": \"Alice\"\n        },\n        {\n            \"name\": \"Bob\"\n        },\n        {\n            \"name\": \"Carol\"\n        }\n    ]\n}\n```\n\nIf you need a literal dot in a key, quote it:\n\n###### slon:\n```\n{\n    \"com.sun.java\" installed\n}\n```\n###### json:\n```\n{\n    \"com.sun.java\": \"installed\"\n}\n```\n\n\n### hooks\n\nA \"bare\" string immediately followed by an opening parenthesis `(` is treated as a function name (\"hook\"). A hook function receives one of the basic values  and can return whatever you see fit. `slon` parser accepts the `hooks` argument, which is an object or a dict containing hook functions (or methods).\n\nYou can use hooks to add support for library types like dates or binary strings. For example, this `slon` file:\n\n```\n// test.slon\n\n{\n    title\n        Hamlet\n    created\n        date('1599-02-20')\n    image\n        bin(\"\\x89PNG\\r\\n\\x1a\\n\\0\\0\\0...\")\n}\n```\n\ncan be decoded with this code:\n\n```\nfrom datetime import date\nfrom functools import partial\n\nhooks = {\n    'date': date.fromisoformat,\n    'bin': partial(bytes, encoding='latin1'),\n}\n\nwith open('test.slon') as fp:\n    result = slon.loads(fp.read(), hooks=hooks)\n\nprint(result) ## {'title': 'Hamlet', 'created': datetime.date(1599, 2, 20), 'image': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00...'}\n\n```\n\n## APIs\n\n### python\n\n```\npip install slon\n```\n\nThe `slon` module provides a single function:\n```\nslon.loads(text: str, as_object=False, as_array=False, hooks=None) -\u003e Any\n```\n\n- `text` is a string (`str`) which contains encoded `slon`. Note that `bytes` inputs are not supported\n\n- `as_object` parses `text` as an object, that is, puts implicit `{...}` around it, unless `text` already starts with a `{`\n\n- `as_array` parses `text` as an array\n\n- `hooks` is a hooks dict or object\n\n\nExamples:\n\n```\ntext = \"\"\"\n    author Shakespeare\n    title Hamlet\n\"\"\"\n\nval = slon.loads(text, as_object=True)\n\nprint(val)  # {'author': 'Shakespeare', 'title': 'Hamlet'}\n\n\ntext = \"\"\"\n    100\n    200\n    300\n\"\"\"\n\nval = slon.loads(text, as_array=True)\n\nprint(val)  # [100, 200, 300]\n```\n\n\n### javascript\n\n```\nnpm install slonjs\n```\n\nThe `slon` module provides a single function:\n\n```\nslon.parse(text: string, options: object) -\u003e any\n```\n\nOptions are `asObject`, `asArray` and `hooks`, with the same meaning as in python.\n\n\n```\nlet slon = require('slon');\n\ntext = `\n    author Shakespeare\n    title Hamlet\n`\n\nval = slon.parse(text, {asObject: true})\n\nconsole.log(val)  // {author: 'Shakespeare', title: 'Hamlet'}\n```\n\nFor browsers, grab `index.js` and use `window.SLON.parse()`.\n\n\n\n## info\n\n(c) 2019 Georg Barikin (https://github.com/gebrkn). MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgebrkn%2Fslon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgebrkn%2Fslon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgebrkn%2Fslon/lists"}