{"id":18141536,"url":"https://github.com/skjolber/jackson-syntax-highlight","last_synced_at":"2026-03-08T14:33:06.857Z","repository":{"id":28740707,"uuid":"119211577","full_name":"skjolber/jackson-syntax-highlight","owner":"skjolber","description":"Syntax highlighting (via ANSI) for JSON output using Jackson","archived":false,"fork":false,"pushed_at":"2025-03-01T03:04:44.000Z","size":143,"stargazers_count":7,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-13T01:41:14.080Z","etag":null,"topics":["ansi","jackson-json-processor","java","json","syntax-highlighting"],"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/skjolber.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-27T23:31:22.000Z","updated_at":"2024-11-03T09:57:17.000Z","dependencies_parsed_at":"2024-05-28T13:30:58.620Z","dependency_job_id":"5dd6f562-3c15-4b0f-a9a4-50edca7ec490","html_url":"https://github.com/skjolber/jackson-syntax-highlight","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skjolber%2Fjackson-syntax-highlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skjolber%2Fjackson-syntax-highlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skjolber%2Fjackson-syntax-highlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skjolber%2Fjackson-syntax-highlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skjolber","download_url":"https://codeload.github.com/skjolber/jackson-syntax-highlight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246201153,"owners_count":20739707,"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":["ansi","jackson-json-processor","java","json","syntax-highlighting"],"created_at":"2024-11-01T17:07:30.129Z","updated_at":"2025-10-18T02:50:02.473Z","avatar_url":"https://github.com/skjolber.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build Status](https://github.com/skjolber/jackson-syntax-highlight/actions/workflows/maven.yml/badge.svg) \n[![Maven Central](https://img.shields.io/maven-central/v/com.github.skjolber.jackson/jackson-syntax-highlight.svg)](https://mvnrepository.com/artifact/com.github.skjolber.jackson/jackson-syntax-highlight)\n\n# This project is currently maintained at [Entur](https://github.com/entur/jackson-syntax-highlight).\n\n# jackson-syntax-highlight\nSimple utility for generating syntax-highlighted [JSON] text using the [Jackson](https://github.com/FasterXML/jackson) library. Inlines [ANSI] color-codes visible in ANSI-enabled consoles.\n\nFeatures: \n  * works with the popular [Jackson] JSON library.\n  * configurable color schemes\n     * datatype\n       * string\n       * number\n       * boolean\n       * null\n     * field name\n     * comma\n     * brackets\n     * colon\n     * whitespace\n\nThe library is primarily intended for adding coloring while doing minimal changes to existing applications. For example, coloring of status codes during unit testing.\n\n## License\n[Apache 2.0]\n\n## Obtain\nThe project is built with [Maven] and is available on the central Maven repository. \n\n\u003cdetails\u003e\n  \u003csummary\u003eMaven coordinates\u003c/summary\u003e\n\nAdd the property\n```xml\n\u003cjackson-syntax-highlight.version\u003e1.0.8\u003c/jackson-syntax-highlight.version\u003e\n```\n\nthen add\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.skjolber.jackson\u003c/groupId\u003e\n    \u003cartifactId\u003ejackson-syntax-highlight\u003c/artifactId\u003e\n    \u003cversion\u003e${jackson-syntax-highlight.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\u003c/details\u003e\n\nor\n\n\u003cdetails\u003e\n  \u003csummary\u003eGradle coordinates\u003c/summary\u003e\n\nFor\n\n```groovy\next {\n  jacksonSyntaxHighlightVersion = '1.0.8'\n}\n```\n\nadd\n\n```groovy\napi (\"com.github.skjolber.jackson:jackson-syntax-highlight:${jacksonSyntaxHighlightVersion}\")\n```\n\u003c/details\u003e\n\n# Usage\nThe highlighter wraps a normal [JsonGenerator]. Pretty-printing is enabled by default.\n\n```java\n// construct output generator\nJsonGenerator delegate = new JsonFactory().createGenerator(writer);\n\n// wrap with syntax highlighter\nJsonGenerator jsonGenerator = new SyntaxHighlightingJsonGenerator(delegate);\n\n// write JSON output\njsonGenerator.writeStartObject(); // start root object\njsonGenerator.writeFieldName(\"name\");\njsonGenerator.writeNumber(123);\njsonGenerator.writeEndObject();\n// .. etc\n```\nSupply an instance of `SyntaxHighlighter` using the builder:\n\n```java\nSyntaxHighlighter highlighter = DefaultSyntaxHighlighter\n                                    .newBuilder()\n                                    .withNumber(AnsiSyntaxHighlight.BLUE)\n                                    .build();\n\t\t\nJsonGenerator jsonGenerator = new SyntaxHighlightingJsonGenerator(delegate, highlighter);\n```\n\nIn addition, the JSON structure can be tracked via [JsonStreamContextListener](src/main/java/com/github/skjolber/jackson/jsh/JsonStreamContextListener.java), for stateful coloring of subtrees. \n\n## Highlighting an object\nWrite a full object using `writeObject`, i.e.\n\n```java\nJsonGenerator jsonGenerator = new SyntaxHighlightingJsonGenerator(delegate, highlighter, prettyprint);\njsonGenerator.writeObject(obj);\n```\n\n## See also\n\n * [logback-logstash-syntax-highlighting-decorators]\n\n# History\n\n - 1.0.8: Add module info. \n - 1.0.7: Do not set default colors.\n - 1.0.6: Add option for single-line output\n - 1.0.3 to 1.0.5: Bump Jackson dependency due to security issue \n - 1.0.2: More tests, minor fixes.\n - 1.0.1: Various improvements, works better with [logback-logstash-syntax-highlighting-decorators] for Logback logging.\n - 1.0.0: Initial version\n\n[Apache 2.0]:          \thttp://www.apache.org/licenses/LICENSE-2.0.html\n[issue-tracker]:       \thttps://github.com/skjolber/jackson-syntax-highlight/issues\n[Maven]:                http://maven.apache.org/\n[SyntaxHighlighter]:\tsrc/main/java/com/github/skjolber/jackson/jsh/SyntaxHighlighter.java\n[Jackson]:\t\t\t\thttps://github.com/FasterXML/jackson\n[ANSI]:\t\t\t\t\thttps://en.wikipedia.org/wiki/ANSI_escape_code\n[JSON]:\t\t\t\t\thttps://no.wikipedia.org/wiki/JSON\n[JsonGenerator]:\t\thttps://github.com/FasterXML/jackson-core/blob/master/src/main/java/com/fasterxml/jackson/core/JsonGenerator.java\n[logback-logstash-syntax-highlighting-decorators]: https://github.com/skjolber/logback-logstash-syntax-highlighting-decorators\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskjolber%2Fjackson-syntax-highlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskjolber%2Fjackson-syntax-highlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskjolber%2Fjackson-syntax-highlight/lists"}