{"id":29410000,"url":"https://github.com/projectitis/jx","last_synced_at":"2026-02-06T01:44:34.372Z","repository":{"id":129113250,"uuid":"266456880","full_name":"projectitis/jx","owner":"projectitis","description":"JX file format specification and tools","archived":false,"fork":false,"pushed_at":"2020-09-03T09:28:35.000Z","size":24,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-11T07:44:25.682Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haxe","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/projectitis.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-05-24T02:39:31.000Z","updated_at":"2022-05-28T14:25:14.000Z","dependencies_parsed_at":"2023-04-19T19:17:02.293Z","dependency_job_id":null,"html_url":"https://github.com/projectitis/jx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/projectitis/jx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectitis%2Fjx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectitis%2Fjx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectitis%2Fjx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectitis%2Fjx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectitis","download_url":"https://codeload.github.com/projectitis/jx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectitis%2Fjx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29144211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T01:13:33.096Z","status":"ssl_error","status_checked_at":"2026-02-06T01:11:47.313Z","response_time":65,"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":[],"created_at":"2025-07-11T05:05:40.583Z","updated_at":"2026-02-06T01:44:34.361Z","avatar_url":"https://github.com/projectitis.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JX\nJX (short for Json eXtended, file extension `.jx`) is a file format based on [JSON](https://www.json.org/json-en.html). JX was designed specifically for configuration files, but has a wide range of potential applications. JSON was designed to be lightweight with minimal rules. JX is a super-set of JSON that supports core JSON but adds many more powerful features. For example:\n* Inline and block comments\n* Keys without quotes\n* Single and double quotes\n* Variables and equations (including user-variables and default values)\n* Color support and manipulation\n* _Look-back referencing (not yet supported)_\n* _Combining JX files (not yet supported)_\n\nHere is an [example jx file](example.jx).\n\n## Licence\nThe JX (Json eXtended) format and the parsers supplied here are Open-Source under the MIT licence (free for any use, personal or commercial, without attribution, but also without warranty).\n\n## Supported languages\nThe library is developed using [Haxe](https://haxe.org). The great thing about Haxe is that it compiles to source code in other languages (such as PHP, c#, c++, Javascript etc), so JX is available in a wide range of languages!\n* [Haxe](/src/haxe/)\n\n## usage (Haxe)\n````\nvar jx : JxParser = new JxParser();\nvar r = jx.parse( \"{ name: 'Projectitis'; }\" );\ntrace(r);\n````\n\n````\nvar jx : JxParser = new JxParser();\njx.variables.set('myName','Projectitis');\nvar r = jx.parse( \"{ name: $myName; }\" );\ntrace(r);\n````\n\n## Status\nWork in progress. Currently a fully working parser, with exceptions noted below (still in progress).\n\n## Versions\nCurrent version v0.21 (August 2020)\n\n## Comments\nJX supports inline comments using __// comment__ and block comments using __/* comment */__. During parsing comments are treated as whitespace, so may occur anywhere that whitespace occurs. Be careful though, this can result in hard-to-read code. Just because you can doesn't mean you should!\n````\n/**\n * Comments and comment blocks (like this one) are supported outside of the root\n * object itself, as well as inside.\n **/\n{\n    // Comment are also supported inside object and arrays\n    MyKey: \"MyValue\", // Comments are supported after variable definitions\n   /* About to define key */ MyOtherKey /* Here coems the colon */ : /* About to set value */ \"Another value\" /* This is also ignored */ ; // The last comment can be inline\n}\n````\n\n## Keys\nKeys do not have to be quoted, as long as they do not contain whitespace characters. They may contain dots (e.g. `foo.bar: \"FOOBAR\"`) however, this may cause difficulties when using look-backs, so it is recommended to avoid them.\n````\n{ This_Key_is-not#quoted: \"And it works\" }\n````\n\n## Quotes\nFor both quoted keys and strings, single and double quotes are supported. A string may contain the other type of quote without escaping, but must escape quotes if they are the same as the enclosing quotes.\n````\n[\n    \"This is 'fine' to do\",\n    'And this is \"also\" fine';\n    \"You can \\\"escape\\\" like this\",\n    'and \\'like\\' this';\n]\n````\n_Note that comma or semi-colon can be used to seperate values._\n\n## Values\nThe standard JSON values are supported, including `String`, `Number`, `true`, `false`, `null`. However, additional value types are supported.\n\nValues can be seperated by comma, or by semicolon (see the **quotes** example above)\n\n### Number\nAs well as decimal integers or floats (`-12`, `14.99`), numbers can also be extressed as hexidecimal (`0xaa72`) or binary (`b10111001`).\n\n### Color\nColors are actually just parsed to a number (integer), but can be expressed in different ways:\n````\n[\n    #ff9900; // css hex format\n    rgb( 255, 153, 0 ); // RGB format (0-255)\n    rgba( 255, 153, 0, 0.4 ); // RGBA format where alpha is 0.0 - 1.0\n]\n````\n\n### Strings\nStrings can wrap lines and contain any whitespace present between the enclosing quotes. Escaped characters such as `\\n` and `\\t` are also supported. Also see notes on _Quotes_ above. These are examples of valid strings:\n````\n[\n    \"This is a long string on multiple lines.\n    Beware - this second line starts with a tab character!\nThis is the third line of the string.\";\n\n    'Strings may contain \"quotes\" as long as they are not the same as the enclosing quotes.';\n\n    \"Strings may be enclosed with either single or double quotes.\";\n]\n````\n\n## Variables\nVariables are denoted by a leading $. Variables always have global scope, no matter where they are defined, and can be used anywhere in the document _after_ they occur (no look-aheads).\n````\n{\n    $baseColor: #ff9900;\n    border-color: $baseColor;\n}\n````\n\n### User variables\nThe user is able to define variables in the parser before parsing a jx file. These are then available as variables within the jx file. An example if `Haxe` is:\n````\nvar jxParser = new JxParser( \"{ myName: $name }\", [\"name\"=\u003e\"Projectitis\"] );\n````\n\n### Default values\nTo support user-variables, a default value can be specified inside the jx file. To do this, prefix the variable definition with a question mark (?). This will only set the value if the variable currently does not have one (i.e. the user has not defined it).\n````\n{\n    ?$name: \"The default name\";\n    myName: $name;\n}\n````\n\n## Equations\nMany math equations are supported directly within the JX document. This is useful in order to change values based on user-defined variables. A full suite of math functions are supported (`min`, `max`, `cos`, `sin`, `round`, `abs`, `random` etc) as well as a range of color manipulation functions such as `darken`, `lighten` and `tint`. String concatenation using + is also supported.\n````\n{\n    ?$name: \"The default name\";\n    ?$baseColor: rgb( 255, 153 ,0 );\n    $highlightColor: #fff;\n    ?$direction: 120;\n    \n    intro: \"Hello \" + $name;\n    background-color: darken( $baseColor, 0.5 );\n    foreground-color: tint( $baseColor, $highlightColor, 0.25 );\n    window-x: sin( degToRad( $direction ) ) * 200;\n    window-y: cos( degToRad( $direction ) ) * 200;\n}\n````\n\n## Look-back references (not yet supported)\nAs well as variables, JX supports look-backs to reference any values that have already been set. Look-forwards are not supported.\n\nLook-backs start with an equals sign (=) and may be quoted. Array access is zero-based. If a key in the path contains a space, it must be escaped by another dot (see below).\n````\n{\n    foo: \"Foo\";\n    foo.bar: \"Has a dot in the key\";\n    bar: [\n        \"Hello\";\n        \"World\";\n        {\n            foo-bar: =bar[1]; // Will be \"World\"\n        }\n    ];\n    foo-bar: =bar[2].foo-bar; // Will also be \"World\"\n    name: =foo; // Will be \"Foo\"\n    hasDot: =\"foo.bar\"; // Will be \"Has a dot in the key\";\n}\n````\nIf the base element is an array:\n````\n[\n    \"Hello\";\n    \"World\";\n    {\n        foo-bar: =[1]; // Will be \"World\"\n        foo-bar-2: =[2].foo-bar; // Will also be \"World\"\n    }\n]\n````\n\n## Combining JX files (not yet supported)\nJX allows combing multiple JX files together. This is useful if, for example, there is a default configuration file that contains all the available options, and then a second \"user\" config file that contains only a few items that need to change. To combine these, the default config is parsed first, and then the user config is parsed over the top of this. Depending on the implementation, this could be achieved by passing in a list of JX files to parse (in order), or by parsing one file first and then passing this in to the second parse as the 'base' data object.\n````\n// Example in haxe\nvar user = JxParser.parse( [defaultConfig, userConfig] );\n// or\nvar base = JxParser.parse( defaultConfig );\nvar user = JxParser.parse( userConfig, base );\n````\nWhen combining JX files, the structure of the files must match or errors will result. For example, if one file has a key called `settings` that is an array (`[ ]`), and the other has a key called `settings` that is an object (`{ }`) or another type that is not an array (e.g. a String, Number etc) then a `type mismatch` error will be thrown.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectitis%2Fjx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectitis%2Fjx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectitis%2Fjx/lists"}