{"id":24529823,"url":"https://github.com/learosema/leon","last_synced_at":"2025-10-06T21:20:17.950Z","repository":{"id":41072332,"uuid":"2132659","full_name":"learosema/leon","owner":"learosema","description":"Lea's Evil Object Notation","archived":false,"fork":false,"pushed_at":"2018-04-05T13:27:07.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-22T07:52:48.795Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/learosema.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}},"created_at":"2011-07-31T15:00:05.000Z","updated_at":"2020-12-02T08:29:17.000Z","dependencies_parsed_at":"2022-08-31T06:51:36.199Z","dependency_job_id":null,"html_url":"https://github.com/learosema/leon","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/learosema%2Fleon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fleon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fleon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fleon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/learosema","download_url":"https://codeload.github.com/learosema/leon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243770600,"owners_count":20345319,"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":"2025-01-22T07:52:52.012Z","updated_at":"2025-10-06T21:20:12.931Z","avatar_url":"https://github.com/learosema.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"LEON.js\n=======\n\nLEON stands for **Lea's Evil Object Notation** and can be used as an alternative to \nJSON. The sense behind LEON is to minimize URL-encoding in stringified JS objects \nwhen you want to send them using ajax via HTTP-POST. \n\nAll chars used by LEONs syntax are safe to use in a POST request without \nurl-encoding them into something like `%HH`.\n\n## Syntax\n\n### Differences between LEON and JSON:\n\n- brackets are represented as a tilde ~ in LEON ( `[] {}` change to `~` ) \n  and the outer brackets are omitted\n- commas are represented as a point (`,` changes to `.`)\n- underscores are to identify a key-value-pair (`key:val` changes to `key_val`)\n- There are no quote signs to identify a string. As a result of this, value types are guessed by the decode method. You can turn off typeGuessing and force Strings by setting `LEON.typeGuessing(false);`\n    - empty strings are guessed to be empty arrays\n    - `true`, `false` is guessed to be a `boolean`, \n    - `null` is guessed to be `null`\n    - `undefined` is guessed to be `undefined`, \n    - `NaN` is guessed to `NaN`, \n    - numeric strings are guessed to be Ints/Floats\n    - everything else is returned as a string\n\n### String escaping rules\n\nString escaping is done using hyphens.\n\n- underscores are escaped to \"-_\"\n- points become \"-.\"\n- tildes are escaped to \"-~\"\n- hyphens are escaped to double hyphens\n- negative integer numbers stay as they are (so -x becomes --x, but -9 stays -9)\n- `-0` is escaped to emptiness. So `abc-0` becomes `abc`. This helps the parser to identify empty objects: `~-0~`. If you want to name something `-0`, then you escape it with a hyphen: `--0`\n\n### Examples\n\n- **JSON:** `[1,2,3,4]`\n- **LEON:** `1.2.3.4`\n\n- **JSON:** `[{x:1,y:[1,2,3],z:{\"border-style\":\"1px solid green\"},a:[1,2,3]},23]`\n- **LEON:** `~x_1.y_~1.2.3~.z_~border--style_1 px solid green~.a_~1.2.3~~.23`\n\n### Usage\n\n- encoding: `LEON.encode(object);`\n- decoding: `LEON.decode(string);`\n\n## FAQ\n\n### Why is LEON so evil ?\n\n- it's untested and created just for fun, in order to get started with the basics of git and github.\n- LEON is less human readable than JSON\n- LEON sounds nicer than just LON :)\n- It has some limitations: \n    - LEON does not have a syntax definition for 1-length arrays (yet). So LEON.decode(LEON.encode([666])) returns 666. \n    - when encoding a string like \"666\", the LEON decoder returns it as a number. You can turn off typeGuessing if you want to force strings.\n    - empty strings are returned as empty arrays []\n\n\n## License\n\nLEON is released under the terms of the MIT license:\n\nCopyright (c) 2018 Lea Rosema\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this \nsoftware and associated documentation files (the \"Software\"), to deal in the Software\nwithout restriction, including without limitation the rights to use, copy, modify, merge,\npublish, distribute, sublicense, and/or sell copies of the Software, and to permit persons \nto whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall \nbe included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, \nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. \nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, \nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, \nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR \nTHE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearosema%2Fleon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flearosema%2Fleon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearosema%2Fleon/lists"}