{"id":45623160,"url":"https://github.com/jezek/funson","last_synced_at":"2026-02-23T19:50:32.415Z","repository":{"id":57586112,"uuid":"128416307","full_name":"jezek/funson","owner":"jezek","description":"another approach to functional json for fun","archived":false,"fork":false,"pushed_at":"2025-06-05T18:18:06.000Z","size":51,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T19:20:54.951Z","etag":null,"topics":["experimental","functional-programming","golang","json","programming-language"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jezek.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":"2018-04-06T16:01:06.000Z","updated_at":"2025-06-05T18:18:08.000Z","dependencies_parsed_at":"2022-09-13T07:50:34.533Z","dependency_job_id":null,"html_url":"https://github.com/jezek/funson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jezek/funson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jezek%2Ffunson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jezek%2Ffunson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jezek%2Ffunson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jezek%2Ffunson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jezek","download_url":"https://codeload.github.com/jezek/funson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jezek%2Ffunson/sbom","scorecard":{"id":517197,"data":{"date":"2025-08-11","repo":{"name":"github.com/jezek/funson","commit":"90cadcb3b12023b5f205e1f17d78e4b53d91ff44"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Code-Review","score":0,"reason":"Found 0/16 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":"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":"Maintained","score":10,"reason":"30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go-test.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go-test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/jezek/funson/go-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go-test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/jezek/funson/go-test.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"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":"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":"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: GNU Affero General Public License v3.0: 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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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"}}]},"last_synced_at":"2025-08-20T02:08:50.612Z","repository_id":57586112,"created_at":"2025-08-20T02:08:50.612Z","updated_at":"2025-08-20T02:08:50.612Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29753483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T19:23:13.917Z","status":"ssl_error","status_checked_at":"2026-02-23T19:23:11.618Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["experimental","functional-programming","golang","json","programming-language"],"created_at":"2026-02-23T19:50:31.727Z","updated_at":"2026-02-23T19:50:32.408Z","avatar_url":"https://github.com/jezek.png","language":"Go","readme":"# funson\nAnother approach to functional JSON for fun.\n\nThe main idea is that the JSON text is the input to a parser, the same JSON text contains the program and output is the JSON text modified by the program.\n\nIn this case, the parser is the ```funson``` executable residing in the ```cmd/funson``` directory.\n\nIf a valid JSON file is given to ```funson``` as argument, the JSON tree is parsed. The JSON tree consists of branches and leaves.\nBranches are array value (```[ … ]```) and object value (```{ … }```).\nAll other values (numbers, strings, true, false, null) are leaves.\n\nIf the parser encounters an leaf type and currently the branch object it doesn't do any operation upon them and leaves them as they are.\nIf the parser encounters an array, and the array qualifies as function, the function is run and the output will be inserted into the tree instead of the array. If the array is not a function, all its elements are parsed (from first to last) and the results will make the new array.\n\nThe array qualifies as function if its first field is a string and begins with ```!``` followed by any other character.\nFor example, if the parser encounters an array looking like ```[ \"!functionName\", 1, true, \"foo\" ]``` it would attempt to run a function ```functionName``` with the values ```1, true, \"foo\"``` as parameters. If the ```funson``` program doesn't know such a function or the parameters mismatch (wrong number of parameters or wrong types) it panics and produces no output. Currently the functions you can use are hard-coded and the list can be viewed by exploring the examples in the ```examples``` directory or the code in ```globalFunctions.go```. Maybe in the future I will implement a way to be able to define functions in the JSON tree itself. (TODO make list of available hardcoded functions, or let the ```funson``` to output them.)\n\nAll the parameters are parsed before calling the function and the parsed results will be fed to the function.\nFor example, if the input is ```[ \"!f1\", 2, [ \"!f2\", 5.8 ], \"bar\" ]```, then first the ```f2``` function is called with ```5.8``` as parameter and then the result will replace the ```[ \"!f2\", 5.8 ]``` array and function ```f1``` will be called. Note: The underlying language is ```go``` which can return more than one result, so the functions in ```funson``` can return multiple results.\n\n## Why?\nI had a cli go project and a part of it was to generate JSON from user input, with some predefined choices. Part of the project was to be able to edit the choices and questions and add/remove stuff to/from the JSON, without recompiling the executable. It was a call for some scripting language that could be embedded into the project. I thought to myself, that it would be fun to have the program, that interacts with user and generates the JSON tree, placed in the same JSON tree. It was my project, my calls and I created funson (functional JSON). Later I extracted the funson part from the project into this package, with the thought that maybe it is an interesting concept and someone would like it and maybe help me to expand and/or make the idea better.\n\n## External golang dependencies:\n- [github.com/mohae/deepcopy](github.com/mohae/deepcopy)\n\n## Useful links\n- [Introducing JSON](https://www.json.org/json-en.html)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjezek%2Ffunson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjezek%2Ffunson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjezek%2Ffunson/lists"}