{"id":13652819,"url":"https://github.com/arkanovicz/essential-json","last_synced_at":"2025-12-25T04:30:52.702Z","repository":{"id":46171521,"uuid":"230427750","full_name":"arkanovicz/essential-json","owner":"arkanovicz","description":"JSON without fuss","archived":false,"fork":false,"pushed_at":"2022-08-30T17:23:39.000Z","size":121,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-02T02:33:46.594Z","etag":null,"topics":["java","json"],"latest_commit_sha":null,"homepage":"","language":"Java","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/arkanovicz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-12-27T10:56:50.000Z","updated_at":"2021-11-09T16:42:33.000Z","dependencies_parsed_at":"2022-09-15T01:32:40.409Z","dependency_job_id":null,"html_url":"https://github.com/arkanovicz/essential-json","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkanovicz%2Fessential-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkanovicz%2Fessential-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkanovicz%2Fessential-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkanovicz%2Fessential-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arkanovicz","download_url":"https://codeload.github.com/arkanovicz/essential-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250365582,"owners_count":21418709,"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","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"],"created_at":"2024-08-02T02:01:03.042Z","updated_at":"2025-12-25T04:30:52.689Z","avatar_url":"https://github.com/arkanovicz.png","language":"Java","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# Essential JSON\n\n- [Essential JSON](#essential-json)\n  * [Rationale](#rationale)\n  * [Description](#description)\n  * [Usage](#usage)\n    + [Inclusion in your project](#inclusion-in-your-project)\n    + [Parsing JSON](#parsing-json)\n    + [Rendering JSON](#rendering-json)\n    + [Building JSON](#building-json)\n    + [Converting to JSON](#converting-to-json)\n  * [References](#references)\n\n## Rationale\n\nAlthough there are already tons of existing [Java JSON libraries](https://gitlab.renegat.net/claude/yajb), I needed one which would:\n\n+ be **minimalistic**\n\n  + **no reflection** of any sort, no validation, no schema, no custom POJO field/class support\n  + **no external dependency**\n  + easily pluggable in other projects: **one single source file**\n\n+ be **performant**\n+ have a nice and handy API with specialized getters and setters\n+ avoid any kind of abstraction other than **Serializable** around values, without any wrapping\n+ use a common **parent Serializable interface** for JSON objects and arrays\n\n## Description\n\n## Usage\n\nThe `com.republicate.json.Json` interface extends `Serializable` and is implemented by its two inner classes `Json.Array` and `Json.Object`.\n\n`Json.Array` extends `List\u003cSerializable\u003e` and `Json.Object` extends `Map\u003cString, Serializable\u003e`.\n\n### Inclusion in your project\n\nUsing Maven:\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.republicate\u003c/groupId\u003e\n        \u003cartifactId\u003eessential-json\u003c/artifactId\u003e\n        \u003cversion\u003e2.5\u003c/version\u003e\n    \u003c/dependency\u003e\n\nUsing Gradle:\n\n    implementation 'com.republicate:essential-json:2.3'\n\n### Parsing JSON\n\nThe generic `Json.parse(string_or_reader)` method will return a `com.republicate.Json` value containing a `Json.Object` or `Json.Array` object.\n\nIf you want to parse a content without knowing if it's a JSON container or a simple JSON value,\nyou will call the `Json.parseValue(string_or_reader)` method to get a `Serializable`. \n\n    import com.republicate.json.Json;\n    ...\n    Json container = Json.parse(string_or_reader);\n    // container will be a JSON object or a JSON array\n    if (container.isObject())\n    {\n        Json.Object obj = container.asObject();\n        ...\n    }\n\n    Serializable value = Json.parseValue(string_or_reader);\n    // value will either be a JSON container or a single Serializable value\n\n### Rendering JSON\n\nContainers `toString()` and `toString(Writer)` methods will render JSON strings with proper quoting and encoding.\n\n    import com.republicate.json.Json;\n    ...\n    // getting a String\n    String json = container.toString();\n\n    // rendering towards a Writer\n    container.toString(writer);\n\n### Building JSON\n\n`Json.Array` and `Json.Object` constructors (or equivalents `Json.newArray()` and `Json.newObject()` helper methods) can respectively be given an existing Iterable or an existing Map ; both can also be given a JSON string.\n\nBoth containers have specialized getters (`getString`, `getBoolean`, etc.).\n\n`Json.Array` has helper methods `push`, `pushAll` and `put` that return self (and rely on the standard `add`, `addAll` and `set` ArrayList methods).\n\n`Json.Object` has helper methods `set` and `setAll` that return self (and rely on the standard `put` and `putAll` Map methods). \n\n    import com.republicate.json.Json;\n    ...\n    Json.Array arr = Json.newArray(\"[1,2,3]\").add(4).add(5);\n    Json.Object obj = new Json.Object(some_existing_map).set(\"foo\", \"bar\").set((\"baz\", arr);\n\n### Converting to JSON\n\nThe two reentrant methods `Json.toJson(java.lang.Object)` and `Json.toSerializable(java.lang.Object)` will try hard to convert any standard Java container to a JSON structure.\n\n## References\n\n+ [RFC 7159](https://tools.ietf.org/html/rfc7159)\n+ [JSON Parsing Test Suite](https://github.com/nst/JSONTestSuite)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkanovicz%2Fessential-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farkanovicz%2Fessential-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkanovicz%2Fessential-json/lists"}