{"id":15287847,"url":"https://github.com/gera2ld/coc-format-json","last_synced_at":"2025-04-13T06:06:53.080Z","repository":{"id":57201984,"uuid":"281444108","full_name":"gera2ld/coc-format-json","owner":"gera2ld","description":"Format JSON strings on the fly","archived":false,"fork":false,"pushed_at":"2022-04-02T04:40:11.000Z","size":17,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T06:06:11.848Z","etag":null,"topics":["coc","json","nvim","vim"],"latest_commit_sha":null,"homepage":"","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/gera2ld.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}},"created_at":"2020-07-21T16:05:57.000Z","updated_at":"2023-03-22T13:49:57.000Z","dependencies_parsed_at":"2022-09-17T11:23:13.249Z","dependency_job_id":null,"html_url":"https://github.com/gera2ld/coc-format-json","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fcoc-format-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fcoc-format-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fcoc-format-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fcoc-format-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gera2ld","download_url":"https://codeload.github.com/gera2ld/coc-format-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670435,"owners_count":21142904,"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":["coc","json","nvim","vim"],"created_at":"2024-09-30T15:38:43.758Z","updated_at":"2025-04-13T06:06:53.019Z","avatar_url":"https://github.com/gera2ld.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coc-format-json\n\n![NPM](https://img.shields.io/npm/v/coc-format-json.svg)\n![License](https://img.shields.io/npm/l/coc-format-json.svg)\n![Downloads](https://img.shields.io/npm/dt/coc-format-json.svg)\n\nFormat JSON strings on top of [coc.nvim](https://github.com/neoclide/coc.nvim), the JavaScript way.\n\n![formatJson](https://user-images.githubusercontent.com/3139113/88083845-1bda5000-cbb6-11ea-9ac3-b50e61de427f.gif)\n\n## Installation\n\nFirst, make sure [coc.nvim](https://github.com/neoclide/coc.nvim) is started.\n\nThen install with the Vim command:\n\n```viml\n:CocInstall coc-format-json\n```\n\n## Usage\n\nMake sure the text to be serialized is valid JSON or text that can be parsed by [JSON5](https://json5.org/).\n\n### Format the whole file\n\n```viml\n:CocCommand formatJson [options]\n```\n\nSee [options](#Options) section for more details.\n\n### Format selected text\n\nFirst make a selection with `v`. Then execute command:\n\n```viml\n:CocCommand formatJson.selected [options]\n```\n\nSee [options](#Options) section for more details.\n\n## Options\n\n### --indent\n\n`--indent=\u003cnumber\u003e`\n\nSet indentation as `\u003cnumber\u003e` spaces. When `\u003cnumber\u003e` is zero, the JSON object will be serialized in compact mode, i.e. no extra white spaces will be kept.\n\n### --quote\n\n`--quote='`\n\nSet the quote character to use, either `'` or `\"`. In typical JSON only `\"` is allowed, however in JavaScript it is common to use `'` everywhere.\n\n### --quote-as-needed\n\n`--quote-as-needed` or `--quote-as-needed=\u003ctrue|false\u003e`\n\nWhile enabled, all quotes will be ommitted if possible, if only the serialized text is valid in JavaScript.\n\n### --trailing\n\n`--trailing` or `--trailing=\u003ctrue|false\u003e`\n\nWhile enabled, an dangling comma will be added to the last entry in each array and object. This is useful in JavaScript so that you don't have to modify the last line before appending a new line.\n\n### --template\n\n`--template` or `--template=\u003ctrue|false\u003e`\n\nWhile enabled, multiline strings will be serialized as template literals quoted with `` ` ``, instead of using escaped characters like `\\n`.\n\n### --sort-keys\n\n`--sort-keys` or `--sort-keys=\u003ctrue|false\u003e`\n\nWhile enabled, keys of an object will be sorted alphabetically.\n\n## Presets\n\nSome presets are available to set a group of options:\n\n- `--preset-js`\n\n  useful to use in JavaScript code, equivalent to `--quote=' --quote-as-needed --trailing --template`.\n\n- `--preset-json`\n\n  useful to use in JSON file, equivalent to `--quote=\" --quote-as-needed=false --trailing=false --template=false`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgera2ld%2Fcoc-format-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgera2ld%2Fcoc-format-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgera2ld%2Fcoc-format-json/lists"}