{"id":27362858,"url":"https://github.com/nanoqsh/json_lang","last_synced_at":"2026-05-18T15:02:07.002Z","repository":{"id":40992861,"uuid":"490339023","full_name":"nanoqsh/json_lang","owner":"nanoqsh","description":"Full-fledged programming in JSON, why not?","archived":false,"fork":false,"pushed_at":"2023-10-19T21:33:29.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-08T05:47:20.393Z","etag":null,"topics":["json","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/nanoqsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2022-05-09T15:24:21.000Z","updated_at":"2025-06-23T18:58:26.000Z","dependencies_parsed_at":"2022-09-20T20:01:24.278Z","dependency_job_id":"aa74edc1-b4f5-4766-bdcb-73c613cc731c","html_url":"https://github.com/nanoqsh/json_lang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nanoqsh/json_lang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoqsh%2Fjson_lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoqsh%2Fjson_lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoqsh%2Fjson_lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoqsh%2Fjson_lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanoqsh","download_url":"https://codeload.github.com/nanoqsh/json_lang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoqsh%2Fjson_lang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275455641,"owners_count":25468218,"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-09-16T02:00:10.229Z","response_time":65,"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","rust"],"created_at":"2025-04-13T03:56:58.563Z","updated_at":"2025-09-16T16:56:51.307Z","avatar_url":"https://github.com/nanoqsh.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Json Lang\nDo you want to program in JSON? This simple executor allows you to do that.\n\n### Constuctions\nThe instruction block is an JSON array. It can list instructions that will be performed sequentially. The last operation is the result of the block expression. If the block is empty, then the result is `nil`.\n```json\n[]\n```\n\nNumbers are just JSON numbers:\n```json\n12\n```\n\nTo read a variable specify a regular JSON string. If the variable is not set, then it has the value `nil`.\n```json\n\"x\"\n```\n\nTo create a string, you need to specify the `str` key:\n```json\n{ \"str\": \"hello\" }\n```\n\nThe `let` block allows you to assign names to values:\n```json\n{\n    \"let\": {\n        \"x\": 1,\n        \"y\": 2\n    }\n}\n```\nVariables have their scope limited of a function call or global scope. So, creating a new variable inside a function will not change a more global variable.\n\nTo print a value, specify the `print` key:\n```json\n{\n    \"print\": { \"str\": \"Hello, World!\" }\n}\n```\n\nArithmetic operators like `+`, `-`, `*`, `/` or the comparison operator `==` can be expressed as:\n```json\n{ \"+\": [12, \"x\"] }\n```\nThe result of this expression will be a sum of value `12` and the variable `x`. If an operation cannot be evaluated, its value will be `nil`. Note that the JSON array here is not a block of instructions, but simply a short notation of two operans instead of `{ \"left\": 12, \"right\": \"x\" }`.\n\nHow to create a function? Just:\n\n```json\n{ \"fn\": 7 }\n```\nThis creates an anonymous function that returns `7`. Let's call it by passing an empty map of parameters, since this function does not take any arguments:\n```json\n{\n    \"call\": { \"fn\": 7 },\n    \"pars\": {}\n}\n```\nThe `call` key specifies a function to call. The `pars` key specifies a function parameters, if it's empty then the key can be omitted.\n\nWhat if you need to give a name to a function? So, let's use the `let` block:\n```json\n{\n    \"let\": {\n        \"function_name\": { \"fn\": 7 }\n    }\n}\n```\n\nThen call it by name:\n```json\n{ \"call\": \"function_name\" }\n```\n\nGood. Let's write some more complex calculation. For example, calculate `1 + x`:\n```json\n{\n    \"fn\": { \"+\": [1, \"x\"] }\n}\n```\nIf you simply call this function without parameters, then the value of `x` will be determined in an outer scope. But we can set this value when calling by passing it as a parameter:\n```json\n{\n    \"call\": {\n        \"fn\": { \"+\": [1, \"x\"] }\n    },\n    \"pars\": { \"x\": 2 }\n}\n```\n\nThe conditional operator will return the `then` value if the `if` value is non-zero or non-empty string, otherwise `else`:\n```json\n{\n    \"if\": { \"==\": [1, 1] },\n    \"then\": 1,\n    \"else\": 2\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoqsh%2Fjson_lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanoqsh%2Fjson_lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoqsh%2Fjson_lang/lists"}