{"id":15490402,"url":"https://github.com/myconsciousness/json-formatter","last_synced_at":"2025-10-06T16:30:44.516Z","repository":{"id":118166344,"uuid":"285016270","full_name":"myConsciousness/json-formatter","owner":"myConsciousness","description":"Lightweight, Extensible and Flexible formatter for JSON based on Java.","archived":false,"fork":false,"pushed_at":"2021-02-04T15:23:02.000Z","size":394,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-19T09:17:52.504Z","etag":null,"topics":["bracket","colon","formatter","formatting","indents","java","json","json-formatter","json-strings"],"latest_commit_sha":null,"homepage":"https://myconsciousness.github.io/json-formatter/","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/myConsciousness.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2020-08-04T15:10:17.000Z","updated_at":"2022-01-10T15:47:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"37937610-9311-43ac-aae9-11c9ee362a6d","html_url":"https://github.com/myConsciousness/json-formatter","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/myConsciousness/json-formatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myConsciousness%2Fjson-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myConsciousness%2Fjson-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myConsciousness%2Fjson-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myConsciousness%2Fjson-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myConsciousness","download_url":"https://codeload.github.com/myConsciousness/json-formatter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myConsciousness%2Fjson-formatter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278643311,"owners_count":26021082,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"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":["bracket","colon","formatter","formatting","indents","java","json","json-formatter","json-strings"],"created_at":"2024-10-02T07:20:58.028Z","updated_at":"2025-10-06T16:30:43.805Z","avatar_url":"https://github.com/myConsciousness.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build](https://img.shields.io/badge/Build-Automated-2980b9.svg?style=for-the-badge)\n![Latest Version](https://img.shields.io/badge/Latest_Version-v1.0.2-27ae60.svg?style=for-the-badge)\n![License](https://img.shields.io/badge/License-Apache_2.0-e74c3c.svg?style=for-the-badge)\u003c/br\u003e\n![Java CI with Gradle](https://github.com/myConsciousness/json-formatter/workflows/Java%20CI%20with%20Gradle/badge.svg?branch=master)\n\n# JSON Formatter\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [What is it?](#what-is-it)\n- [How To Use](#how-to-use)\n  - [1. Add the dependencies](#1-add-the-dependencies)\n  - [2. Add an import for **_JSON Fomratter_**](#2-add-an-import-for-_json-fomratter_)\n  - [3. Create a instance](#3-create-a-instance)\n  - [4. Format](#4-format)\n- [Demonstrate I/O](#demonstrate-io)\n- [License](#license)\n- [More Information](#more-information)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## What is it?\n\n**_This is a formatter for JSON strings._**\n\n`JSON Formatter` is specialized in formatting JSON strings that do not use regular expressions and has no functions other than formatting. **_Therefore it is extremely lightweight besides can be expanded to meet user needs._**\n\n## How To Use\n\n### 1. Add the dependencies\n\n\u003e **_Note:_**\u003c/br\u003e\n\u003e Replace version you want to use. Check the latest [Packages](https://github.com/myConsciousness/json-formatter/packages).\u003c/br\u003e\n\u003e Please contact me for a token to download the package.\n\n**_Maven_**\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.thinkit.formatter\u003c/groupId\u003e\n  \u003cartifactId\u003ejson-formatter\u003c/artifactId\u003e\n  \u003cversion\u003ev1.0.2\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003cservers\u003e\n  \u003cserver\u003e\n    \u003cid\u003egithub\u003c/id\u003e\n    \u003cusername\u003emyConsciousness\u003c/username\u003e\n    \u003cpassword\u003exxxxxxxxxxxxxxxxxx\u003c/password\u003e\n  \u003c/server\u003e\n\u003c/servers\u003e\n```\n\n**_Gradle_**\n\n```gradle\nrepositories {\n    maven {\n        name = \"GitHubPackages\"\n        url = uri(\"https://maven.pkg.github.com/myConsciousness/json-formatter\")\n        credentials {\n          username = \"myConsciousness\"\n          password = \"xxxxxxxxxxxxxxxxxx\"\n        }\n    }\n}\n\ndependencies {\n    implementation 'org.thinkit.formatter:json-formatter:v1.0.2'\n}\n```\n\n### 2. Add an import for [**_JSON Fomratter_**](https://github.com/myConsciousness/json-formatter/blob/master/src/main/java/org/thinkit/formatter/json/JsonFormatter.java)\n\n```java\nimport org.thinkit.formatter.json.JsonFormatter;\n```\n\n### 3. Create a instance\n\n```java\nFormatter formatter = JsonFormatter.newInstance();\n```\n\nYou can also create an instance with a specific number of indents as following.\n\n\u003e **_Note:_**\u003c/br\u003e\n\u003e If a negative indentation is passed at instantiation time, the initial value defined in the [content file](https://github.com/myConsciousness/json-formatter/blob/master/src/main/resources/content/org/thinkit/formatter/json/JsonDefaultIndent.json) takes precedence.\n\n```java\nFormatter formatter = JsonFormatter.from(indent);\n```\n\n### 4. Format\n\n```java\nFormatter formatter = JsonFormatter.from(indent);\nString formattedJson = formatter.format(json);\n```\n\n## Demonstrate I/O\n\nI have prepared the following unformatted json string for input/output reference. This is the json template for `content-framework`, but it's hard to see without any spaces or line breaks.\n\n```txt\n    {\"metadata\":{\"author\":\"Kato Shinya\",\"since\":\"1.0\",\"version\":\"1.0\",\"creationDate\":\"2020/06/24\",\"encoding\":\"UTF-8\",\"description\":\"test\"},\"selectionNodes\":[{\"node\":{\"conditionId\":\"0\",\"test1\":\"test\",\"test2\":\"test\"}},{\"node\":{\"conditionId\":\"1\",\"test1\":\"test\",\"test2\":\"test\"}},{\"node\":{\"conditionId\":\"2\",\"test1\":\"test\",\"test2\":\"test\"}}],\"conditionNodes\":[{\"node\":{\"conditionId\":\"0\",\"exclude\":false,\"conditions\":[{\"keyName\":\"test\",\"operand\":\"=\",\"value\":\"0\"}]}},{\"node\":{\"conditionId\":\"1\",\"exclude\":false,\"conditions\":[{\"keyName\":\"test\",\"operand\":\"=\",\"value\":\"1\"}]}},{\"node\":{\"conditionId\":\"2\",\"exclude\":false,\"conditions\":[{\"keyName\":\"test\",\"operand\":\"=\",\"value\":\"2\"}]}}]}\n```\n\nLet's run `JSON Formatter` with the JSON string of above template as an argument.\n\n```java\nJsonFormatter.newInstance().format(json);\n```\n\nThe output is as follows.\n\n\u003e **_Note:_**\u003c/br\u003e\n\u003e Whitespace in the JSON string before formatting is trimmed during the formatting process, so no pre-processing is required.\n\n```json\n{\n  \"metadata\": {\n    \"author\": \"Kato Shinya\",\n    \"since\": \"1.0\",\n    \"version\": \"1.0\",\n    \"creationDate\": \"2020/06/24\",\n    \"encoding\": \"UTF-8\",\n    \"description\": \"test\"\n  },\n  \"selectionNodes\": [\n    {\n      \"node\": {\n        \"conditionId\": \"0\",\n        \"test1\": \"test\",\n        \"test2\": \"test\"\n      }\n    },\n    {\n      \"node\": {\n        \"conditionId\": \"1\",\n        \"test1\": \"test\",\n        \"test2\": \"test\"\n      }\n    },\n    {\n      \"node\": {\n        \"conditionId\": \"2\",\n        \"test1\": \"test\",\n        \"test2\": \"test\"\n      }\n    }\n  ],\n  \"conditionNodes\": [\n    {\n      \"node\": {\n        \"conditionId\": \"0\",\n        \"exclude\": false,\n        \"conditions\": [\n          {\n            \"keyName\": \"test\",\n            \"operand\": \"=\",\n            \"value\": \"0\"\n          }\n        ]\n      }\n    },\n    {\n      \"node\": {\n        \"conditionId\": \"1\",\n        \"exclude\": false,\n        \"conditions\": [\n          {\n            \"keyName\": \"test\",\n            \"operand\": \"=\",\n            \"value\": \"1\"\n          }\n        ]\n      }\n    },\n    {\n      \"node\": {\n        \"conditionId\": \"2\",\n        \"exclude\": false,\n        \"conditions\": [\n          {\n            \"keyName\": \"test\",\n            \"operand\": \"=\",\n            \"value\": \"2\"\n          }\n        ]\n      }\n    }\n  ]\n}\n```\n\n## License\n\n```license\nCopyright 2020 Kato Shinya.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except\nin compliance with the License. You may obtain a copy of the License at\n\n     http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License\nis distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\nor implied. See the License for the specific language governing permissions and limitations under\nthe License.\n```\n\n## More Information\n\n`JSON Formatter` was designed and implemented by Kato Shinya, who works as a freelance developer.\n\nRegardless of the means or content of communication, I would love to hear from you if you have any questions or concerns. I do not check my email box very often so a response may be delayed, anyway thank you for your interest!\n\n- [Creator Profile](https://github.com/myConsciousness)\n- [Creator Website](https://myconsciousness.github.io/)\n- [License](https://github.com/myConsciousness/json-formatter/blob/master/LICENSE)\n- [Release Note](https://github.com/myConsciousness/json-formatter/releases)\n- [Package](https://github.com/myConsciousness/json-formatter/packages)\n- [File a Bug](https://github.com/myConsciousness/json-formatter/issues)\n- [Reference](https://myconsciousness.github.io/json-formatter/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyconsciousness%2Fjson-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyconsciousness%2Fjson-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyconsciousness%2Fjson-formatter/lists"}