{"id":23215509,"url":"https://github.com/emilymclean/json-specialiser","last_synced_at":"2026-04-29T00:35:09.822Z","repository":{"id":177804168,"uuid":"660937130","full_name":"emilymclean/JSON-Specialiser","owner":"emilymclean","description":"A library and specification for specialising an unstructured JSON document","archived":false,"fork":false,"pushed_at":"2023-07-02T07:32:09.000Z","size":126,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-04-05T13:44:18.623Z","etag":null,"topics":["json"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emilymclean.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}},"created_at":"2023-07-01T09:18:49.000Z","updated_at":"2023-09-21T00:46:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"959c8768-3451-4952-a17b-1b0dde4df0e9","html_url":"https://github.com/emilymclean/JSON-Specialiser","commit_stats":null,"previous_names":["benmmclean/json-specialiser","emilymclean/json-specialiser"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/emilymclean/JSON-Specialiser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emilymclean%2FJSON-Specialiser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emilymclean%2FJSON-Specialiser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emilymclean%2FJSON-Specialiser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emilymclean%2FJSON-Specialiser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emilymclean","download_url":"https://codeload.github.com/emilymclean/JSON-Specialiser/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emilymclean%2FJSON-Specialiser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32405902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: 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":["json"],"created_at":"2024-12-18T20:17:01.802Z","updated_at":"2026-04-29T00:35:09.808Z","avatar_url":"https://github.com/emilymclean.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Specialiser\n[![Unit Test](https://github.com/BenMMcLean/JSON-Specialiser/actions/workflows/unit.yml/badge.svg)](https://github.com/BenMMcLean/JSON-Specialiser/actions/workflows/unit.yml)\n[![Build](https://github.com/BenMMcLean/JSON-Specialiser/actions/workflows/build.yml/badge.svg)](https://github.com/BenMMcLean/JSON-Specialiser/actions/workflows/build.yml)\n\nJSON Specialiser (JSON-S) is a tool for taking in any structured\nor unstructured JSON document and generating a client specialised\nto a client. This is primary use case for the technology is to\nmanage large config files that are delivered to a variety of \nclients.\n\nJSON-S documents are written exactly like regular JSON, in fact\na plain JSON string is entirely valid JSON-S code. JSON-S is\nannotated with special \"control codes\", that instruct the compiler\nhow a document should be interpreted and modified. Control codes\nare keys in a JSON object that start with a #, and contain \narguments describing their function. An example of a control code\nis like so:\n```json\n{\n  \"platformText\": {\n    \"#selector\": [\n      {\n        \"claims\": [[\"android\"]],\n        \"child\": \"You are an Android user!\"\n      },\n      {\n        \"child\": \"You are not an Android user :(\"\n      }\n    ]\n  }\n}\n```\n\nIn the above example, given a client with the claim \"android\", the\noutput from the compiler would be\n```json\n{\n  \"platformText\": \"You are an Android user!\"\n}\n```\n\n## Codes\n### #selector\nThe selector control code allows the compiler to choose between\nany number of options based on information about the client. By\ndefault, the code only evaluates based on \"claims\", a list of\nstrings that represent the client, but the compiler can be extended\nwith custom fields (for example, a field matching max and min\nversion could be implemented).\n\nClaims are grouped in an all-any relationship, where the nested\narrays represent a group of claims that must match the client entirely,\nand the top level arrays just need any of the nested conditions to \nmatch. For example\n\nGiven a client that has the claims `[\"claim1\", \"claim2\"]`, \n`[[\"claim1\", \"claim3\"], [\"claim4\"]]` would not match, since the user \ndoesn't have both claim (1 \u0026\u0026 4) || 5. On the other hand, \n`[[\"claim1\"], [\"claim3\"]]` would match, since the user has claim1.\n\nThe arguments of selector are a list of options, those options\nconstituting some number of conditions (or none, for an else branch)\nand a child that will be inserted after evaluation. Options are in\npriority order, the first option that matches will be returned.\n\nAn example of a selector can be seen above.\n\n### #include\nInclude allows the document to insert another JSON document in place.\nFor this to work, the compiler must be provided a FileAccessStrategy.\nAn example of an include is as follows:\n```json\n{\n  \"#include\": {\n    \"file\": \"otherfile.json\"\n  }\n}\n```\n\nThis feature is useful for managing large and complex files.\n\n### #combine\nCombine flattens any nested set of arrays xor objects. It is used like\nso:\n```json\n{\n  \"#combine\": [\n    {\n      \"key\": \"value\"\n    },\n    {\n      \"key1\": \"value1\"\n    }\n  ]\n}\n```\nwhich would output\n\n```json\n{\n  \"key\": \"value\",\n  \"key1\": \"value1\"\n}\n```\n\nArrays work similarly\n```json\n{\n  \"#combine\": [\n    [\"thing1\", \"thing2\"],\n    [\"thing3\"]\n  ]\n}\n```\nwould output\n```json\n[\"thing1\", \"thing2\", \"thing3\"]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femilymclean%2Fjson-specialiser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femilymclean%2Fjson-specialiser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femilymclean%2Fjson-specialiser/lists"}