{"_id":"@croct/json5-parser","_rev":"5-c01302f46c76e42e5a49de04a1f9da00","name":"@croct/json5-parser","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"@croct/json5-parser","version":"0.1.0","keywords":["json5","parser","tokenizer"],"author":{"url":"https://github.com/croct-tech/json5-parser-js","name":"Croct","email":"lib+json5-parser-js@croct.com"},"license":"MIT","_id":"@croct/json5-parser@0.1.0","maintainers":[{"name":"marcospassos","email":"marcospassos.com@gmail.com"},{"name":"fryuni","email":"luiz@lferraz.com"},{"name":"croct-bot","email":"bot@croct.com"}],"homepage":"https://github.com/croct-tech/json5-parser-js","bugs":{"url":"https://github.com/croct-tech/json5-parser-js/issues"},"dist":{"shasum":"ad06eb12411963ca35b4e78efabfb7bb3b7e040b","tarball":"https://registry.npmjs.org/@croct/json5-parser/-/json5-parser-0.1.0.tgz","fileCount":44,"integrity":"sha512-iHScZ85NF+fuMSZFKmpxfzRREIDYd/aBeWw+/WyzP03F0cGyApbmg+bcsnCrdHwTpUzFEGuorLlVqdEslQjlTQ==","signatures":[{"sig":"MEUCIAYZto9anVpLykgrbpUonOSPIacY+UV2hrcMjtEOtcQOAiEA753wzTUKQmLmefvLMPjXp2KaiB1asSrjs2DSLDnfMMg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":96265},"main":"index.js","types":"index.d.ts","gitHead":"cc7b4fbf3fc35877f28ff51f2bf5962c1c33a5f0","scripts":{"lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","test":"jest -c jest.config.js --coverage","build":"tsc -p tsconfig.build.json","validate":"tsc --noEmit"},"_npmUser":{"name":"croct-bot","email":"bot@croct.com"},"repository":{"url":"git+https://github.com/croct-tech/json5-parser-js.git","type":"git"},"_npmVersion":"10.8.2","description":"A lossless JSON5 tokenizer and parser for Node.js that maintains indentation, spacing, and comments.","directories":{},"_nodeVersion":"20.18.3","dependencies":{"@croct/json":"^2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","eslint":"^8.57.1","ts-node":"^10.8.2","@swc/jest":"^0.2.24","typescript":"^5.0.0","@types/jest":"^29.0.0","jest-extended":"^4.0.0","@croct/eslint-plugin":"^0.7.0","@typescript-eslint/parser":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/json5-parser_0.1.0_1740785596660_0.3232582664582908","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@croct/json5-parser","version":"0.1.1","keywords":["json5","parser","tokenizer"],"author":{"url":"https://github.com/croct-tech/json5-parser-js","name":"Croct","email":"lib+json5-parser-js@croct.com"},"license":"MIT","_id":"@croct/json5-parser@0.1.1","maintainers":[{"name":"marcospassos","email":"marcos@marcospassos.com"},{"name":"fryuni","email":"luiz@lferraz.com"},{"name":"croct-bot","email":"marcos+npm@croct.com"}],"homepage":"https://github.com/croct-tech/json5-parser-js","bugs":{"url":"https://github.com/croct-tech/json5-parser-js/issues"},"dist":{"shasum":"62d6cf8c1c47cdaed934ea89b0ee9886791fdadd","tarball":"https://registry.npmjs.org/@croct/json5-parser/-/json5-parser-0.1.1.tgz","fileCount":44,"integrity":"sha512-7+yo8Kd5JJp+VF3bjYGXW0S1s3zOF6IiJczmQy1d+t/pFn8bo7kJcbzRP+C78kcqZoBW4gs5H/c7ZtsH5DDb7w==","signatures":[{"sig":"MEQCIH0FLRloiLlqKE/VXHqhrPjmL+3uUb0vvXVx2104aemMAiAsLmmrFA2TcfNFo9U+6Slx9nZkNmDSyDteNhJRt3Q4/Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":96327},"main":"index.js","types":"index.d.ts","gitHead":"c000db43d26e410e6c52c684a380a106ca4c2d80","scripts":{"lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","test":"jest -c jest.config.js --coverage","build":"tsc -p tsconfig.build.json","validate":"tsc --noEmit"},"_npmUser":{"name":"croct-bot","email":"marcos+npm@croct.com"},"repository":{"url":"git+https://github.com/croct-tech/json5-parser-js.git","type":"git"},"_npmVersion":"10.8.2","description":"A lossless JSON5 tokenizer and parser for Node.js that maintains indentation, spacing, and comments.","directories":{},"_nodeVersion":"20.19.1","dependencies":{"@croct/json":"^2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","eslint":"^8.57.1","ts-node":"^10.8.2","@swc/jest":"^0.2.24","typescript":"^5.0.0","@types/jest":"^29.0.0","jest-extended":"^4.0.0","@croct/eslint-plugin":"^0.7.0","@typescript-eslint/parser":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/json5-parser_0.1.1_1747422845777_0.42249075625090504","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@croct/json5-parser","version":"0.2.0","keywords":["json5","parser","tokenizer"],"author":{"url":"https://github.com/croct-tech/json5-parser-js","name":"Croct","email":"lib+json5-parser-js@croct.com"},"license":"MIT","_id":"@croct/json5-parser@0.2.0","maintainers":[{"name":"marcospassos","email":"marcos@marcospassos.com"},{"name":"fryuni","email":"luiz@lferraz.com"},{"name":"croct-bot","email":"marcos+npm@croct.com"}],"homepage":"https://github.com/croct-tech/json5-parser-js","bugs":{"url":"https://github.com/croct-tech/json5-parser-js/issues"},"dist":{"shasum":"604daebc9a5222c440e9c68a8309e2ca60144c1d","tarball":"https://registry.npmjs.org/@croct/json5-parser/-/json5-parser-0.2.0.tgz","fileCount":44,"integrity":"sha512-bDFbKB5M/J9OIFc8nivlgRSln9zrweBOALA0BGC73jnB+5UyGD/aYj2sonAwEexKt6QDY2fW13tf3+nkiLi4CQ==","signatures":[{"sig":"MEYCIQDYmi4bgajBHntXe1gVb6KxjkeHGJTM5UyDFr4W5dr99gIhAK3kanrEdJZF51UJdp+xW/gTp+h92nPsy9Zb1vyh1v1P","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":101955},"main":"index.js","types":"index.d.ts","gitHead":"7f0cbc24b5a73037d5d5a03c1e5c0e00dd18fc07","scripts":{"lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","test":"jest -c jest.config.js --coverage","build":"tsc -p tsconfig.build.json","validate":"tsc --noEmit"},"_npmUser":{"name":"croct-bot","email":"marcos+npm@croct.com"},"repository":{"url":"git+https://github.com/croct-tech/json5-parser-js.git","type":"git"},"_npmVersion":"10.8.2","description":"A lossless JSON5 tokenizer and parser for Node.js that maintains indentation, spacing, and comments.","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@croct/json":"^2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","eslint":"^8.57.1","ts-node":"^10.8.2","@swc/jest":"^0.2.24","typescript":"^5.0.0","@types/jest":"^29.0.0","jest-extended":"^4.0.0","@croct/eslint-plugin":"^0.7.0","@typescript-eslint/parser":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/json5-parser_0.2.0_1756393760327_0.24893903335776968","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@croct/json5-parser","version":"0.2.1","keywords":["json5","parser","tokenizer"],"author":{"url":"https://github.com/croct-tech/json5-parser-js","name":"Croct","email":"lib+json5-parser-js@croct.com"},"license":"MIT","_id":"@croct/json5-parser@0.2.1","maintainers":[{"name":"marcospassos","email":"marcos@marcospassos.com"},{"name":"fryuni","email":"luiz@lferraz.com"},{"name":"croct-bot","email":"marcos+npm@croct.com"}],"homepage":"https://github.com/croct-tech/json5-parser-js","bugs":{"url":"https://github.com/croct-tech/json5-parser-js/issues"},"dist":{"shasum":"8cb2b4a5ac466311f26704d2b6286341cc3dcd1f","tarball":"https://registry.npmjs.org/@croct/json5-parser/-/json5-parser-0.2.1.tgz","fileCount":44,"integrity":"sha512-YB21uimsK6lZOUr8z+W0gsLI3TlUz4e1iWtN4qxiAsl7yCBgeg7Xfc3Y8kRJzWnZL/eOU5WaMgD09KOyuqenuQ==","signatures":[{"sig":"MEQCICTyqFLi7B+blzt18Hr2uNMh7Ppjcd/p6DeAoq2nbf4RAiAk+M1GzbkDtioMG3zzD5iPIdDDuS9wDVDYg+n6ruOvhA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":102235},"main":"index.js","types":"index.d.ts","gitHead":"60b80684609ec55d4a2c4eaf0043012c5fb4e5da","scripts":{"lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","test":"jest -c jest.config.js --coverage","build":"tsc -p tsconfig.build.json","validate":"tsc --noEmit"},"_npmUser":{"name":"croct-bot","email":"marcos+npm@croct.com"},"repository":{"url":"git+https://github.com/croct-tech/json5-parser-js.git","type":"git"},"_npmVersion":"10.8.2","description":"A lossless JSON5 tokenizer and parser for Node.js that maintains indentation, spacing, and comments.","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@croct/json":"^2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","eslint":"^8.57.1","ts-node":"^10.8.2","@swc/jest":"^0.2.24","typescript":"^5.0.0","@types/jest":"^29.0.0","jest-extended":"^4.0.0","@croct/eslint-plugin":"^0.7.0","@typescript-eslint/parser":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/json5-parser_0.2.1_1756399539181_0.7840039534629695","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@croct/json5-parser","version":"0.2.2","description":"A lossless JSON5 tokenizer and parser for Node.js that maintains indentation, spacing, and comments.","author":{"name":"Croct","email":"lib+json5-parser-js@croct.com","url":"https://github.com/croct-tech/json5-parser-js"},"license":"MIT","keywords":["json5","parser","tokenizer"],"types":"index.d.ts","main":"index.js","repository":{"type":"git","url":"git+https://github.com/croct-tech/json5-parser-js.git"},"bugs":{"url":"https://github.com/croct-tech/json5-parser-js/issues"},"homepage":"https://github.com/croct-tech/json5-parser-js","scripts":{"lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","test":"jest -c jest.config.js --coverage","validate":"tsc --noEmit","build":"tsc -p tsconfig.build.json"},"devDependencies":{"@croct/eslint-plugin":"^0.7.0","@swc/jest":"^0.2.24","@types/jest":"^29.0.0","@typescript-eslint/parser":"^8.0.0","eslint":"^8.57.1","jest":"^29.0.0","jest-extended":"^4.0.0","ts-node":"^10.8.2","typescript":"^5.0.0"},"dependencies":{"@croct/json":"^2.1.0"},"_id":"@croct/json5-parser@0.2.2","gitHead":"330e43e0e83a028f1435b2b3fd1125e60cd4eb51","_nodeVersion":"20.19.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-0NJMLrbeLbQ0eCVj3UoH/kG2QckUgOASfwmfDTjyW1xAYPyTNJXcWVT/dssJdTJd0pRchW+qF0VFWQHcxs1OVw==","shasum":"db34595cd746ba846769cc57fa1a1dc552940177","tarball":"https://registry.npmjs.org/@croct/json5-parser/-/json5-parser-0.2.2.tgz","fileCount":44,"unpackedSize":106683,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIExsAm7c0oq4JGDjrEMk71EutcXOsXbgERK/EXDBJfFYAiB/awYric3dy/zIVoPZSYOUorIPa254w4C46xPcMLJzDQ=="}]},"_npmUser":{"name":"croct-bot","email":"marcos+npm@croct.com"},"directories":{},"maintainers":[{"name":"marcospassos","email":"marcos@marcospassos.com"},{"name":"fryuni","email":"luiz@lferraz.com"},{"name":"croct-bot","email":"marcos+npm@croct.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/json5-parser_0.2.2_1764597310899_0.8500508954877295"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-28T23:33:16.591Z","modified":"2025-12-01T13:55:11.313Z","0.1.0":"2025-02-28T23:33:16.858Z","0.1.1":"2025-05-16T19:14:05.980Z","0.2.0":"2025-08-28T15:09:20.525Z","0.2.1":"2025-08-28T16:45:39.391Z","0.2.2":"2025-12-01T13:55:11.083Z"},"bugs":{"url":"https://github.com/croct-tech/json5-parser-js/issues"},"author":{"name":"Croct","email":"lib+json5-parser-js@croct.com","url":"https://github.com/croct-tech/json5-parser-js"},"license":"MIT","homepage":"https://github.com/croct-tech/json5-parser-js","keywords":["json5","parser","tokenizer"],"repository":{"type":"git","url":"git+https://github.com/croct-tech/json5-parser-js.git"},"description":"A lossless JSON5 tokenizer and parser for Node.js that maintains indentation, spacing, and comments.","maintainers":[{"name":"marcospassos","email":"marcos@marcospassos.com"},{"name":"fryuni","email":"luiz@lferraz.com"},{"name":"croct-bot","email":"marcos+npm@croct.com"}],"readme":"<p align=\"center\">\n    <a href=\"https://croct.com\">\n        <img src=\"https://cdn.croct.io/brand/logo/repo-icon-green.svg\" alt=\"Croct\" height=\"80\"/>\n    </a>\n    <br />\n    <strong>JSON5 Parser</strong>\n    <br />\n    A lossless JSON5 tokenizer and parser for Node.js that maintains indentation, spacing, and comments.\n</p>\n<p align=\"center\">\n    <a href=\"https://www.npmjs.com/package/@croct/json5-parser\"><img alt=\"Version\" src=\"https://img.shields.io/npm/v/@croct/json5-parser\"/></a>\n    <a href=\"https://github.com/croct-tech/json5-parser-js/actions/workflows/branch-validations.yaml\"><img alt=\"Build\" src=\"https://github.com/croct-tech/json5-parser-js/actions/workflows/branch-validations.yaml/badge.svg\" /></a>\n    <a href=\"https://codeclimate.com/repos/67c21d34cbf7e400df9b5dbc/test_coverage\"><img src=\"https://api.codeclimate.com/v1/badges/e527bdbf3e2b58919c97/test_coverage\" /></a>\n    <a href=\"https://codeclimate.com/repos/67c21d34cbf7e400df9b5dbc/maintainability\"><img src=\"https://api.codeclimate.com/v1/badges/e527bdbf3e2b58919c97/maintainability\" /></a>\n    <br />\n    <br />\n    <a href=\"https://github.com/croct-tech/json5-parser-js/releases\">📦 Releases</a>\n    ·\n    <a href=\"https://github.com/croct-tech/json5-parser-js/issues/new?labels=bug&template=bug-report.md\">🐞 Report Bug</a>\n    ·\n    <a href=\"https://github.com/croct-tech/json5-parser-js/issues/new?labels=enhancement&template=feature-request.md\">✨ Request Feature</a>\n</p>\n\n## Overview\n\nThis library provides an API for working with JSON and [JSON5](https://json5.org/) documents while preserving their original structure and formatting. \nUnlike traditional JSON parsers that use an Abstract Syntax Tree (AST) and discard formatting, this library leverages a Concrete Syntax Tree (CST) to retain every detail—comments, indentation, and whitespace.\n\nIdeal for editing configuration files (e.g., `package.json`, `tsconfig.json`) or any user-generated JSON5 content, this library ensures that formatting remains intact throughout modifications.\n\n### Key features\n\n- **Preserve formatting** – Read, modify, and write JSON5 files without losing comments, indentation, or spacing.\n- **Style learning** – Automatically applies the document's existing formatting style to new entries.\n- **Reformatting** – Customize output formatting with flexible options.\n- **Type safety** – Fully typed API for working with JSON5 documents.\n\n## Installation\n\nInstall via [NPM](https://www.npmjs.com):\n\n```sh\nnpm install @croct/json5-parser\n```\n\n## Usage\n\nThe library provides a simple API for parsing, manipulating, and serializing JSON5 documents.\n\n### Lexing\n\nUsually, you don't need to interact with the lexer directly. However, you can use it to tokenize a JSON5 document:\n\n```ts\nimport {JsonLexer} from '@croct/json5-parser';\n\nconst tokens = JsonLexer.tokenize(\n    `{\n        // Comment\n        \"name\": \"John Doe\",\n        \"age\": 42,\n    }`\n);\n```\n\n### Parsing\n\nTo parse a JSON5 document:\n\n```ts\nimport {JsonParser} from '@croct/json5-parser';\n\nconst node = JsonParser.parse(\n    `{\n        // Comment\n        \"name\": \"John Doe\",\n        \"age\": 42,\n    }`\n);\n```\n\nOptionally, specify the expected root node type to narrow down the result:\n\n```ts\nimport {JsonParser, JsonObjectNode} from '@croct/json5-parser';\n\nconst node = JsonParser.parse(\n    `{\n        // Comment\n        \"name\": \"John Doe\",\n        \"age\": 42,\n    }`,\n    JsonObjectNode\n);\n```\n\n### Manipulation\n\nModify values while preserving formatting:\n\n```ts\n// Get the value of a property\nconst name = node.get('name').toJSON();\n\n// Update a property\nnode.set('age', 43);\n\nconsole.log(node.toString());\n```\n\nNew entries adopt the document's existing style:\n\n```ts\nnode.set('country', 'USA');\n\nconsole.log(node.toString());\n```\n\nOutput:\n\n```json5\n{\n    // Comment\n    \"name\": \"John Doe\",\n    \"age\": 43,\n    \"country\": \"USA\",\n}\n```\n\nFormatting is applied at a block level, handling different styles within the same document:\n\n```json5\n{\n  \"name\": \"My Project\",\n  \"version\": \"1.0.0\",\n  \"keywords\": [\"json5\", \"parser\"],\n}\n```\n\nAdding an array entry keeps the existing format:\n\n```ts\nnode.set('stack', ['react', 'typescript']);\n```\n\nOutput:\n\n```json5\n{\n  \"name\": \"My Project\",\n  \"version\": \"1.0.0\",\n  \"keywords\": [\"json5\", \"parser\"],\n  \"stack\": [\"react\", \"typescript\"],\n}\n```\n\nTo reset formatting and apply a new style:\n\n```ts\nnode.reset();\n\nconsole.log(node.toString({/* formatting options */}));\n```\n\nOutput:\n\n```json5\n{\n  \"name\": \"My Project\",\n  \"version\": \"1.0.0\",\n  \"keywords\": [\n    \"json5\",\n    \"parser\"\n  ],\n  \"stack\": [\n    \"react\",\n    \"typescript\"\n  ]\n}\n```\n\nRefer to the [Formatting](#formatting) section for details on available options.\n\nTo update the document while preserving formatting, use the `update` method:\n\n```ts\n\nnode.update({\n    ...node.toJSON(),\n    \"version\": \"2.0.0\",\n});\n```\n\nThe `update` method reconciles the new content with the existing document, preserving comments, indentation, and spacing.\n\nFor single updates, prefer the `set` method for better performance:\n\n```ts\nnode.set('version', '2.0.0');\n```\n\nTo merge two documents while preserving comments and formatting from both, use the `merge` method:\n\n```ts\n\nconst destinationCode = `{\n  // Destination pre-foo comment\n  \"foo\": \"value\",\n  // Destination post-foo comment\n  \"baz\": [1, 2, 3]\n}\n`;\n\nconst sourceCode = `{\n  /* Source pre-bar comment */\n  \"bar\": 123, /* Inline comment */\n  /* Source post-bar comment */\n  \"baz\": true /* Another inline comment */\n}\n`;\n\nconst source = JsonParser.parse(sourceCode, JsonObjectNode);\nconst destination = JsonParser.parse(destinationCode, JsonObjectNode);\n\ndestination.merge(source)\n\nconsole.log(destination.toString());\n```\n\nOutput:\n\n```json5\n{\n  // Destination pre-foo comment\n  \"foo\": \"value\",\n  /* Source pre-bar comment */\n  \"bar\": 123, /* Inline comment */\n  /* Source post-bar comment */\n  \"baz\": true /* Another inline comment */\n}\n```\n\n### Formatting\n\nWhen you call `toString(options)` you can control how the output is formatted.\nIf an option is omitted, the formatter learns from the current document and keeps its style. If no style can be inferred, \nthe formatter falls back to a compact style with no extra spaces or indentation.\n\n#### Options\n\n| Option                       | Type/Values          | Description                                            |\n|------------------------------|----------------------|--------------------------------------------------------|\n| `indentationLevel`           | `number`             | Base indentation level for the document.               |\n| `indentationCharacter`       | `'space'\\|'tab'`     | Character used for indentation.                        |\n| `lineEnding`                 | `'lf'\\|'crlf'`       | Newline sequence to use in the document.               |\n| `string.quote`               | `'single'\\|'double'` | Quotation style for string values.                     |\n| `property.quote`             | `'single'\\|'double'` | Quotation style for property keys.                     |\n| `property.unquoted`          | `boolean`            | Allow unquoted property keys when valid.               |\n| `array.indentationSize`      | `number`             | Indentation size for array entries.                    |\n| `array.trailingIndentation`  | `boolean`            | Indent closing bracket on a new line.                  |\n| `array.leadingIndentation`   | `boolean`            | Indent opening bracket on a new line.                  |\n| `array.entryIndentation`     | `boolean`            | Indent each array entry.                               |\n| `array.trailingComma`        | `boolean`            | Append a trailing comma after the last entry.          |\n| `array.commaSpacing`         | `boolean`            | Add space after commas in arrays.                      |\n| `array.colonSpacing`         | `boolean`            | Add space after colons in arrays (for objects inline). |\n| `object.indentationSize`     | `number`             | Indentation size for object properties.                |\n| `object.trailingIndentation` | `boolean`            | Indent closing brace on a new line.                    |\n| `object.leadingIndentation`  | `boolean`            | Indent opening brace on a new line.                    |\n| `object.entryIndentation`    | `boolean`            | Indent each object property.                           |\n| `object.trailingComma`       | `boolean`            | Append a trailing comma after the last property.       |\n| `object.commaSpacing`        | `boolean`            | Add space after commas in objects.                     |\n| `object.colonSpacing`        | `boolean`            | Add space after colons in objects.                     |\n\n#### Quick recipes\n\nHere are some common formatting styles you can achieve by combining different options.\n\n##### 1) Compact, single-line arrays; pretty multi-line objects\n\n```ts\nnode.toString({\n    array: {\n        leadingIndentation: false,   // keep arrays inline\n        trailingIndentation: false,\n        trailingComma: false,\n        commaSpacing: true,\n    },\n    object: {\n        entryIndentation: true,      // multi-line objects\n        leadingIndentation: true,    \n        trailingIndentation: true,\n        indentationSize: 2,\n        trailingComma: true,\n        commaSpacing: true,\n        colonSpacing: true,\n    },\n});\n```\n\nOutput style:\n\n```json5\n{\n  \"name\": \"My Project\",\n  \"keywords\": [\"json5\", \"parser\"], // array kept inline\n  \"deps\": {\n    \"typescript\": \"^5.6.0\",       // multi-line object\n    \"vite\": \"^5.4.0\",\n  }\n}\n```\n\n##### 2) Tabs everywhere, single quotes, properties quoted only when necessary\n\n```ts\nnode.toString({\n  indentationCharacter: 'tab',\n  string: {\n      quote: 'single'\n  },\n  property: {\n      quote: 'single', \n      unquoted: true\n  },\n  object: {\n    leadingIndentation: true,\n    entryIndentation: true,\n    trailingIndentation: true,\n    trailingComma: false,\n    commaSpacing: true,\n    colonSpacing: true,\n  },\n});\n```\n\nOutput style:\n\n```json5\n{\n\tfoo: 'bar',\n\titems: [\n\t\t'a',\n\t\t'b'\n\t]\n}\n```\n\n##### 3) Strict compact style (no spaces after commas/colons)\n\n```ts\nnode.toString();\n```\n\nOutput style:\n\n```json5\n{\"a\":1,\"b\":[1,2,3]}\n```\n\n## Contributing\n\nContributions are welcome!\n\n- Report issues on the [issue tracker](https://github.com/croct-tech/json5-parser-js/issues).\n- For major changes, [open an issue](https://github.com/croct-tech/json5-parser-js/issues) first to discuss.\n- Ensure test coverage is updated accordingly.\n\n## Testing\n\nInstall dependencies:\n\n```sh\nnpm install\n```\n\nRun tests:\n\n```sh\nnpm run test\n```\n\nLint code to check for style issues:\n\n```sh\nnpm run lint\n```\n","readmeFilename":"README.md"}