{"id":34888344,"url":"https://github.com/sjf4j-projects/sjf4j","last_synced_at":"2026-03-11T06:00:45.636Z","repository":{"id":327517300,"uuid":"1081834640","full_name":"sjf4j-projects/sjf4j","owner":"sjf4j-projects","description":"Simple JSON Facade for Java","archived":false,"fork":false,"pushed_at":"2026-03-04T04:57:45.000Z","size":1312,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-04T08:27:45.723Z","etag":null,"topics":["data-mapping","java","json","json-path","json-schema","yaml"],"latest_commit_sha":null,"homepage":"https://sjf4j.org","language":"Java","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/sjf4j-projects.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-23T11:03:09.000Z","updated_at":"2026-03-04T05:06:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sjf4j-projects/sjf4j","commit_stats":null,"previous_names":["sjf4j-projects/sjf4j"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/sjf4j-projects/sjf4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjf4j-projects%2Fsjf4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjf4j-projects%2Fsjf4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjf4j-projects%2Fsjf4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjf4j-projects%2Fsjf4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjf4j-projects","download_url":"https://codeload.github.com/sjf4j-projects/sjf4j/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjf4j-projects%2Fsjf4j/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30372533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["data-mapping","java","json","json-path","json-schema","yaml"],"created_at":"2025-12-26T04:21:00.691Z","updated_at":"2026-03-11T06:00:45.628Z","avatar_url":"https://github.com/sjf4j-projects.png","language":"Java","readme":"# SJF4J — Simple JSON Facade for Java\n\n![License](https://img.shields.io/github/license/sjf4j-projects/sjf4j)\n![Supported Dialects](https://img.shields.io/endpoint?url=https%3A%2F%2Fbowtie.report%2Fbadges%2Fjava-org.sjf4j-sjf4j%2Fsupported_versions.json)\n![Maven Central](https://img.shields.io/maven-central/v/org.sjf4j/sjf4j)\n[![javadoc](https://javadoc.io/badge2/org.sjf4j/sjf4j/javadoc.svg)](https://javadoc.io/doc/org.sjf4j/sjf4j)\n![Stars](https://img.shields.io/github/stars/sjf4j-projects/sjf4j?style=social)  \n![Build](https://img.shields.io/github/actions/workflow/status/sjf4j-projects/sjf4j/gradle.yml?branch=main)\n\n**SJF4J** is a lightweight facade over multiple JSON libraries, \nincluding [Jackson 2.x](https://github.com/FasterXML/jackson-databind), \n[Gson](https://github.com/google/gson), \n[Fastjson2](https://github.com/alibaba/fastjson2),\n[JSON-P](https://github.com/jakartaee/jsonp-api).  \nBeyond JSON, it also supports for YAML (via [SnakeYAML](https://github.com/snakeyaml/snakeyaml))\nand Java Properties (built-in).\n\nSJF4J provides **a unified JSON-semantic structural processing layer**,\ndelivering consistent and expressive APIs for parsing, navigation, transformation, \nand validation across formats and native object graphs.\n## Install\nSJF4J requires `JDK 8+` and has no external dependencies.\n\nGradle\n```groovy\nimplementation(\"org.sjf4j:sjf4j:{version}\")\n```\nMaven\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.sjf4j\u003c/groupId\u003e\n    \u003cartifactId\u003esjf4j\u003c/artifactId\u003e\n    \u003cversion\u003e{version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**Optional Runtime Backends**  \nSJF4J itself has no external runtime dependencies.  \nFormat support is activated only when the corresponding libraries are present.\n\n- **JSON** — Include one of: `Jackson 2.x`, `Gson`, `Fastjson2`, or `JSON-P` (with `Parsson` or other).  \n  SJF4J automatically detects and uses the first available implementation in that order.\n  If none are detected, it falls back to a built-in minimal JSON parser (functional but slower).\n\n\n- **YAML** — Include `SnakeYAML`.\n\n- **Java Properties** — A built-in parser is provided.  \n  Conversions from Java Properties are inherently constrained by its flat key-value structure.\n\n- **In-Memory Usage** (No External Data) — SJF4J does not require external parsing.  \n  It can operate directly on in-memory object graphs through OBNT,\n  providing the same JSON-semantic APIs for navigation, transformation, and validation.\n\n## Quickstart\n\nSJF4J is built around a single structural model: the **Object-Based Node Tree (OBNT)**.\n- All structured data in SJF4J are mapped into OBNT.\n- All nodes in OBNT are represented as native Java objects -- no dedicated AST.\n- All APIs operate directly on native Java objects.\n- All APIs follow -- or extend -- standard JSON semantics.\n\nThe following example, while slightly more elaborate, \ndemonstrates the whole lifecycle:\n\u003e **Modeling → Parsing → Navigation → Transformation → Validation**\n\n### Modeling in OBNT\n\n**JOJO (JSON Object Java Object)** extends `JsonObject` and unifies typed Java fields \nwith dynamic JSON properties in a single object model.\n\nDefine a JOJO `Student`:\n```java\npublic class Student extends JsonObject {\n    private String name;\n    private Map\u003cString, Integer\u003e scores;\n    private List\u003cStudent\u003e friends;\n    // Getters and setters\n}\n```\n\nLearn more → [Modeling (OBNT)](https://sjf4j.org/docs/modeling)\n\n### Parsing from JSON\n\nUse `Sjf4j` to encode and decode structured data across multiple formats through a unified facade.\n```java\nString json = \"\"\"\n{\n    \"name\": \"Alice\",\n    \"scores\": {\"math\": 59, \"art\": 95},\n    \"friends\": [\n        {\"name\": \"Bill\", \"active\": true, \"scores\": {\"math\": 83}},\n        {\"name\": \"Cindy\", \"friends\": [{\"name\": \"David\", \"scores\": {\"math\": 95}}]}\n    ],\n    \"age\": 18\n}\n\"\"\";\n\nStudent student = Sjf4j.fromJson(json, Student.class);\n```\n\nNow `student` exposes two complementary access models:\n- Strongly-typed Java getters/setters\n- JSON-semantic dynamic APIs\n\n```java\nstudent.getName();                  // Alice\nstudent.getInteger(\"age\");          // 18\n```\n\nLearn more → [Parsing (Codec)](https://sjf4j.org/docs/parsing)\n\n### Navigating with JSON Path\n\nEvery OBNT node supports declarative structural navigation, expressive querying,\nand precise mutation via `JSON Path` or `JSON Pointer`.\n```java\nstudent.getIntegerByPath(\"$.scores.math\");\n// 59\n\nstudent.findByPath(\"$..friends[?@.scores.math \u003e= 90].name\", String.class);  \n// [\"David\"]\n\nstudent.ensurePutByPath(\"/friends/0/scores/music\", 100);\n// Bill's scores becomes: {\"math\": 83, \"music\": 100}\n```\n\nLearn more → [Navigation (JSON Path)](https://sjf4j.org/docs/navigation)\n\n### Transforming with JSON Patch\n\nEvery OBNT node supports standard-compliant structural updates via `JSON Patch`.\n```java\nJsonPatch patch = JsonPatch.fromJson(\"\"\"\n[\n    { \"op\": \"replace\", \"path\": \"/name\", \"value\": \"Alice Zhang\" },\n    { \"op\": \"add\",     \"path\": \"/scores/physics\", \"value\": 91 }\n]\n\"\"\");\n\npatch.apply(student);\n```\n\nThe changes are applied in-place:\n```java\nstudent.getName();                              // \"Alice Zhang\"\nstudent.getIntegerByPath(\"$.scores.physics\");   // 91\n```\n\nLearn more → [Transformation (JSON Patch)](https://sjf4j.org/docs/transformation)\n\n### Validating with JSON Schema\n\nDeclare JSON Schema constraints with `@ValidJsonSchema` (Jakarta Bean Validation–style).\n```java\n@ValidJsonSchema(\"\"\"\n{\n  \"$ref\": \"#/$defs/Student\",\n  \"$defs\": {\n    \"Student\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"name\": {\n          \"type\": \"string\",\n          \"minLength\": 1\n        },\n        \"scores\": {\n          \"type\": \"object\",\n          \"additionalProperties\": {\"type\": \"integer\", \"minimum\": 0}\n        },\n        \"friends\": {\n          \"type\": \"array\",\n          \"items\": {\"$ref\": \"#/$defs/Student\"}\n        }\n      },\n      \"required\": [\"name\"]\n    }\n  }\n}\n\"\"\")\npublic class Student extends JsonObject {\n    private String name;\n    private Map\u003cString, Integer\u003e scores;\n    private List\u003cStudent\u003e friends;\n}\n```\n\nValidate at runtime:\n```java\nSchemaValidator validator = new SchemaValidator();\nvalidator.validate(student).isValid();                  // true\n```\n\nLearn more → [Validation (JSON Schema)](https://sjf4j.org/docs/validation)\n\n## Benchmarks\nSJF4J is designed to minimize structural overhead while preserving unified semantics.\n\n**JSON Parsing Performance**  \nUsing SJF4J introduces approximately 5–10% overhead compared to native JSON libraries,\nwhile providing a unified API, structural abstraction, and extended functionality.\n\n**Reflection Access Performance**  \nLambda-based accessor generation minimizes reflection overhead,\ndelivering performance close to direct field or method invocation.\n\n**JSON Schema Validation Performance**  \nSJF4J fully supports JSON Schema draft 2020-12 and\nconsistently ranks among the top-performing Java implementations in [Bowtie](https://bowtie.report/#/implementations/java-sjf4j) benchmarks.\n\nLearn more → [Benchmarks](https://sjf4j.org/docs/benchmarks)\n\n## Contributing\nGiven that JSON has evolved into a well-defined and widely adopted specification,\nSJF4J began as an exploration of what JSON-Oriented Development might look like in Java.\n\nIf you find the project interesting,\ncontributions of all kinds — code, docs, bug reports, discussions, examples, or benchmarks — are welcome~!\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjf4j-projects%2Fsjf4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjf4j-projects%2Fsjf4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjf4j-projects%2Fsjf4j/lists"}