{"id":20019968,"url":"https://github.com/joeattardi/json-colorizer","last_synced_at":"2025-10-24T00:58:42.500Z","repository":{"id":45854701,"uuid":"72257063","full_name":"joeattardi/json-colorizer","owner":"joeattardi","description":"A library for colorizing JSON strings","archived":false,"fork":false,"pushed_at":"2024-04-30T11:07:44.000Z","size":205,"stargazers_count":81,"open_issues_count":2,"forks_count":18,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-05-02T00:47:46.333Z","etag":null,"topics":["chalk","json","syntax-highlighting"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/joeattardi.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":"2016-10-29T01:29:25.000Z","updated_at":"2024-06-18T13:32:37.362Z","dependencies_parsed_at":"2024-04-23T12:15:32.709Z","dependency_job_id":"53c39e5a-0cc7-480b-84c2-5ffdf93a7f21","html_url":"https://github.com/joeattardi/json-colorizer","commit_stats":{"total_commits":37,"total_committers":10,"mean_commits":3.7,"dds":0.3783783783783784,"last_synced_commit":"4d6448f5e98633cd318bd58001dc0c29e210b0e1"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeattardi%2Fjson-colorizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeattardi%2Fjson-colorizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeattardi%2Fjson-colorizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeattardi%2Fjson-colorizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joeattardi","download_url":"https://codeload.github.com/joeattardi/json-colorizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226215,"owners_count":20904465,"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":["chalk","json","syntax-highlighting"],"created_at":"2024-11-13T08:29:18.571Z","updated_at":"2025-10-24T00:58:37.479Z","avatar_url":"https://github.com/joeattardi.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# JSON Colorizer\n\n![Logo](logo.png)\n\nA library for colorizing JSON strings\n\n![](https://raw.githubusercontent.com/joeattardi/json-colorizer/master/screenshot.png)\n\nThis package is a simple console syntax highlighter for JSON.\n\n## Installation\n`npm install --save json-colorizer`\n\n## Usage\n\n```js\nconst { colorize } = require('json-colorizer');\nconsole.log(colorize({ \"foo\": \"bar\" }));\n```\n\nYou can also pass a JavaScript object to the `colorize` function:\n\n```js\nconst { colorize } = require('json-colorizer');\nconsole.log(colorize({\n  foo: 'bar',\n  baz: 42\n}));\n```\n\n## Pretty-printing output\n\nBy default, the output JSON will be pretty-printed with an indentation of 2 spaces. You can adjust this by passing the `indent` option.\n\n```js\nconst { colorize } = require('json-colorizer');\nconsole.log(colorize({\n  foo: 'bar',\n  baz: 42\n}, { indent: 4 }));\n```\n\n## Customizing the colors\n\nYou can override any of the colors used for token types by providing a `colors` option. This should map token types to the names of color functions. These color functions are contained in the `color` object exported by the library.\n\n```js\nconst { colorize, color } = require('json-colorizer');\n\nconsole.log(colorize({ foo: 'bar' }, {\n  colors: {\n    StringLiteral: color.red\n  }\n}));\n```\n\nThe list of valid token types and color functions are listed below.\n\n### Token types\n\n- `Brace`: curly braces (`{`, `}`)\n- `Bracket`: square brackets (`[`, `]`)\n- `Colon`: colon character (`:`)\n- `Comma`: comma character (`,`)\n- `StringKey`: the key in a key/value pair\n- `NumberLiteral`: a number value\n- `StringLiteral`: a string value\n- `BooleanLiteral`: a boolean literal (`true`, `false`)\n- `NullLiteral`: the literal `null` value\n\n### Color functions in the `color` object\n\n- `black`\n- `red`\n- `green`\n- `yellow`\n- `blue`\n- `magenta`\n- `cyan`\n- `white`\n- `gray`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeattardi%2Fjson-colorizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoeattardi%2Fjson-colorizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeattardi%2Fjson-colorizer/lists"}