{"id":16204668,"url":"https://github.com/nerjalnosk/jsonlight","last_synced_at":"2026-01-28T17:03:53.114Z","repository":{"id":43441390,"uuid":"439951739","full_name":"NerjalNosk/JsonLight","owner":"NerjalNosk","description":"A lightweight Java JSON API aiming to fully support Json5 and more -- Disclaimer ; source is set to migrate to https://gitlab.com/nerjalnosk/jsonlight along with a refactoring of the API to `io.gitlab.nerjalnosk...` to match with the SonaType requirements for Maven Central release","archived":false,"fork":false,"pushed_at":"2024-09-26T09:21:15.000Z","size":2769,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T00:23:03.758Z","etag":null,"topics":["java","json","json-api","json5"],"latest_commit_sha":null,"homepage":"","language":"Java","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/NerjalNosk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"nerjalnosk","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2021-12-19T19:36:09.000Z","updated_at":"2025-02-05T16:57:17.000Z","dependencies_parsed_at":"2024-10-27T20:23:47.381Z","dependency_job_id":"ea3a4455-d5ff-4a4a-abe9-f4d6abee1357","html_url":"https://github.com/NerjalNosk/JsonLight","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/NerjalNosk/JsonLight","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NerjalNosk%2FJsonLight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NerjalNosk%2FJsonLight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NerjalNosk%2FJsonLight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NerjalNosk%2FJsonLight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NerjalNosk","download_url":"https://codeload.github.com/NerjalNosk/JsonLight/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NerjalNosk%2FJsonLight/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28847057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"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":["java","json","json-api","json5"],"created_at":"2024-10-10T09:58:54.960Z","updated_at":"2026-01-28T17:03:53.091Z","avatar_url":"https://github.com/NerjalNosk.png","language":"Java","funding_links":["https://ko-fi.com/nerjalnosk"],"categories":[],"sub_categories":[],"readme":"# JsonLight\n\n## Description\n\nThis is a lightweight Java Json5+ library, providing full [Json5](https://json5.org)\nsupport, along-side many features inspired from other formats such as\n[HOCON](https://github.com/lightbend/config/blob/main/HOCON.md).\nRead more about these additions in the [Json Extension](#json-extension) part.\n\n### Example\n\n```java\nimport io.github.nerjalnosk.jsonlight.elements.JsonComment;\nimport io.github.nerjalnosk.jsonlight.elements.JsonNumber;\nimport io.github.nerjalnosk.jsonlight.elements.JsonObject;\nimport io.github.nerjalnosk.jsonlight.JsonParser;\n\nimport static io.github.nerjalnosk.jsonlight.JsonError.*;\n\npublic abstract class Main {\n    /**\n     * Prints the following:\n     * ```\n     * {\n     *     \"a\": 1\n     *     //this is a comment\n     * }\n     * ```\n     */\n    public static void main(String[] args) {\n        JsonObject object = new JsonObject();\n        object.put(\"a\", new JsonNumber(1));\n        object.add(null, new JsonComment(\"this is a comment\"));\n        try {\n            System.out.println(JsonParser.stringify(object));\n        } catch (RecursiveJsonElementException e) {\n            e.printStackTrace();\n        }\n    }\n}\n```\n\n## Json extension\n\nAs of 3.0, JsonLight includes a Json5 extension, as Json6 of sorts, which adds multiple features to regular Json5.\n\nThese features mostly aim to make life easier for all users.\n\nAdditionally, version 3.2 adds new means to control which of these features are enabled upon parsing text to Json.\nThat way, you can use full options just as well as restricting it all the way down to Json4.\n\n```java\nimport io.github.nerjalnosk.jsonlight.elements.JsonElement;\nimport io.github.nerjalnosk.jsonlight.parser.ParserOptions;\nimport io.github.nerjalnosk.jsonlight.parser.StringParser;\n\nclass MyClass {\n    private final var json4 = new StringParser(new ParserOptions.Builder().json4().build());\n    private final var json5 = new StringParser(new ParserOptions.Builder().json5().build());\n    private final var full = new StringParser(new ParserOptions.Builder().extended().build());\n\n    JsonElement[] parse(String s) {\n        json4.setParseString(s);\n        json5.setParseString(s);\n        full.setParseString(s);\n        return new JsonElement[] {\n                json4.parse(),\n                json5.parse(),\n                full.parse()\n        };\n    }\n}\n```\n\n### Circular structures\n\nIntroduced in version 3.0, it adds support for circular structures parsing, both to and from textual sources.\nIndeed, it allows to reference an element inside itself, to avoid infinite text transformation\nloops.\n\nThis extension works with an ID system (automatically generated), textualized as `\u003c@id\u003e`\nand `\u003c#id\u003e`, respectively the *declaration* and *reference*, where `id` is an unsigned integer.\nThis ID  will of course be provided at the \"declaration\" of the element, as well as the later\nreferencing of that element.\n\n#### Example\n\n```\n{\n  \"key_1\": \"value_1\",\n  \"key_2\": \u003c@1234\u003e { // here, the element with ID \"1234\" is declared. We will remember this ID.\n    \"key_2.1\": \"value_2.1\",\n    \"key_2.2\": [\n      \u003c#1234\u003e, // here, the element with ID \"1234\" is referenced. We link it to the earlier declaration.\n      {\n        \"key_3\": \"value_3\"\n      }\n    ]\n  }\n}\n```\n\nOf course, referencing an undeclared element will result in an error. But upon automated stringification,\nreferences will only be generated for elements located inside themselves, to whichever level.\n\nDeclaring an unused ID, on the contrary, will not cause an issue, but it will not be kept upon\nfurther stringification.\n\n__Note__ : IDs will most likely change upon each automated parsing/stringification, as they are\nnot kept in the processed elements. This also include not being able to recognise an element by\nits ID at runtime.\n\n### Open trailing\n\nIntroduced in version 3.1, it adds support for non-closed data structures at the end of a parsed source.\n\nIt is only supported at the very end of a parsed element to avoid getting messed up\ndata which would end up lost because of something as genuine as a typo,\nbut still provides a safeguard for potential data loss if a text is cut short or\na file cannot be read until its very end.\n\nThis is of course applied recursively over all non-closed container element upon parsing.\n\nThere are however exceptions to what can or cannot be closed in such ways:\n* Arrays can be validated despite not having a closing character `]`.\n* Strings can be validated despite not having a closing character (quotations).\n* Object keys cannot be validated if they do not have a closing character but are opened with one (quotation).\n* Objects cannot be validated if they have a trailing key with no linked value.\n* Objects can be validated if they have no closing character `}`, and the precedent rules are not broken.\n* Object references or ID declaration cannot be validated if they do not have a closing character `\u003e`.\n* Block comments can be validated if they do not have a closing sequence `*/.`\n\n#### Examples\n\n```json5\n[\n  [\n    [\n      [\n        3,\n        4,\n        5,\n        /**\n         * This is a non-closed block comment haha\n```\nThe above structure would be parsed as a valid array\ncontaining a single array containing a single array containing a single array,\nwhich at last contains the numbers 3, 4 and 5, as well as a block comment.\n\nHowever, the following would be considered as invalid, as the inner array is never closed, while the `key` object still gets its own closure.\n```json5\n{\n  \"key\": {\n    \"array\": [\n      3,\n      4,\n      5,\n  }\n```\n\n### Line break iteration\n\nSince version 3.2, JsonLight also supports using line break as iteration markers, allowing to neglect commas.\nHowever, they do not strictly replace commas, so commas can still be used alongside line breaks.\n\n#### Example\n\n```json5\n{\n  root: {\n    key1: 1\n    key2: 2\n  }\n  other_root: [\n    1\n    2\n    3\n    4\n  ]\n}\n```\n\n## Import\n\nNow in Maven Central! Latest available version: \n[4.0](https://mvnrepository.com/artifact/io.github.nerjalnosk/JsonLight/4.0)\n\n### With Maven\n\n```xml\n\n\u003cproject xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\"\u003e\n    \u003cmodelVersion\u003e4.0.0\u003c/modelVersion\u003e\n\n    \u003cgroupId\u003e...\u003c/groupId\u003e\n    \u003cartifactId\u003e...\u003c/artifactId\u003e\n    \u003cversion\u003e...\u003c/version\u003e\n    \n    \u003cproperties\u003e\n        \u003cjsonLight.version\u003e3.2\u003c/jsonLight.version\u003e\n    \u003c/properties\u003e\n\n    \u003cdependencies\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003eio.github.nerjalnosk\u003c/groupId\u003e\n            \u003cartifactId\u003eJsonLight\u003c/artifactId\u003e\n            \u003cversion\u003e${jsonlight.version}\u003c/version\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n\u003c/project\u003e\n```\n\n### With Gradle\n\n```groovy\ndependencies {\n    implementation \"io.github.nerjalnosk:jsonlight:${jsonligh_version}\"\n}\n```\n\n#### Older versions\n\nFor versions before 2.0, please use [Jitpack](https://jitpack.io) in\norder to import the library in your own project.\n\n_With Maven_\n\n```xml\n\u003cproject xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\u003e\n    \u003cmodelVersion\u003e4.0.0\u003c/modelVersion\u003e\n\n    \u003cgroupId\u003e...\u003c/groupId\u003e\n    \u003cartifactId\u003e...\u003c/artifactId\u003e\n    \u003cversion\u003e...\u003c/version\u003e\n    \n    \u003crepositories\u003e\n        \u003crepository\u003e\n            \u003cid\u003ejitpack.io\u003c/id\u003e\n            \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n            \u003csnapshots\u003e\n                \u003cenabled\u003etrue\u003c/enabled\u003e\n                \u003cupdatePolicy\u003ealways\u003c/updatePolicy\u003e\n            \u003c/snapshots\u003e\n        \u003c/repository\u003e\n    \u003c/repositories\u003e\n    \n    \u003cdependencies\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.github.NerjalNosk\u003c/groupId\u003e\n            \u003cartifactId\u003eJsonLight\u003c/artifactId\u003e\n            \u003cversion\u003e1.4.0\u003c/version\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n\u003c/project\u003e\n```\n\n_With Gradle_\n\n```groovy\nrepositories {\n    maven { url \"https://jitpack.io\" }\n}\n\ndependencies {\n    implementation \"com.github.NerjalNosk:JsonLight:1.4.0\"\n}\n```\n\n## History\n\n| Version | Date          | Name                       | Changes                                                                                              |\n|---------|---------------|----------------------------|------------------------------------------------------------------------------------------------------|\n| 1.4.0   | 10 Aug. 2022  | Witcheries and Stringeries | Json stringification rework, added parsing options and defaults, and more parsing tools              |\n| 1.4.1   | 18 Sept. 2023 | TechniLexicalities         | Codebase repo fixes, jdoc and build improvements, parsing logging utilities                          |\n| 2.0     | 18 Sept. 2023 | Maven Conquest             | Classes refactoring, published to Maven Central                                                      |\n| 2.1     | 25 Sept. 2023 | Number Parse               | Fixed number parsing (from/to hexadecimal, from scientific notation)                                 |\n| 3.0     | 11 Mar. 2024  | Json Circles               | Added circular structure parsing, both to and from, using ID markers                                 |\n| 3.1     | 13 Mar. 2024  | Numbers Galore             | Added Number support for Big integers and decimals, as well as more exact value tracking             |\n| 3.2     | 19 Mar. 2024  | Parse lives matter         | Added parsing methods customization tools, and possibility to use line breaks as iteration markers   |\n| 3.3     | 4 Apr. 2024   | Unified cloning            | Completes support for unicode parsing and recoding, improves comments handling, adds cloning methods |\n| 4.0     | 9 Jun. 2024   | Remapped unmapped mapping  | Reworked the Mapper core, added new functionalities regarding errors and providers. Updated unmapper |\n| 4.1     | 24 Sept. 2024 | Stone-Age mapping          | Fixed primitive mapping casting, minor patches                                                       |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerjalnosk%2Fjsonlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnerjalnosk%2Fjsonlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerjalnosk%2Fjsonlight/lists"}