{"id":15704036,"url":"https://github.com/aminya/minijson","last_synced_at":"2025-08-01T02:04:02.268Z","repository":{"id":45219700,"uuid":"382785833","full_name":"aminya/minijson","owner":"aminya","description":"Minify JSON files fast! Supports Comments. Uses D, C, and AVX2 and SSE4_1 SIMD.","archived":false,"fork":false,"pushed_at":"2024-09-10T08:54:10.000Z","size":710,"stargazers_count":7,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T08:06:15.756Z","etag":null,"topics":["avx","avx2","benchmark","build-tool","dlang","dlanguage","javascript","json","minify","minify-javascript","minify-json","minifying","nodejs","simd","simd-instructions","sse","sse41","sse42"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@aminya/minijson","language":"D","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/aminya.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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},"funding":{"github":["aminya"],"polar":"aminya","patreon":"aminya"}},"created_at":"2021-07-04T07:01:18.000Z","updated_at":"2025-03-11T14:12:03.000Z","dependencies_parsed_at":"2024-09-10T09:43:33.017Z","dependency_job_id":"baf36a06-6785-4a7d-b9c8-adc763c5affb","html_url":"https://github.com/aminya/minijson","commit_stats":{"total_commits":201,"total_committers":1,"mean_commits":201.0,"dds":0.0,"last_synced_commit":"cc2f633536c1a827fe1fdbee23ae690c74d4ca89"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminya%2Fminijson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminya%2Fminijson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminya%2Fminijson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminya%2Fminijson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aminya","download_url":"https://codeload.github.com/aminya/minijson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251790613,"owners_count":21644248,"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":["avx","avx2","benchmark","build-tool","dlang","dlanguage","javascript","json","minify","minify-javascript","minify-json","minifying","nodejs","simd","simd-instructions","sse","sse41","sse42"],"created_at":"2024-10-03T20:09:59.309Z","updated_at":"2025-04-30T22:25:01.088Z","avatar_url":"https://github.com/aminya.png","language":"D","readme":"# minijson\n\nMinify JSON files blazing fast, removing comments/whitespace.\n\nUses D, C, and AVX2 and SSE4_1 SIMD. 4180 times faster than jsonminify!\n\n[![CI](https://github.com/aminya/minijson/actions/workflows/CI.yml/badge.svg)](https://github.com/aminya/minijson/actions/workflows/CI.yml)\n\n### Installation\n\n- Npm (Nodejs)\n\n```shell\nnpm install @aminya/minijson\n```\n\n- Dub (D)\n\n```shell\ngit submodule update --init --recursive\ndub build --config=library --build=release-nobounds --compiler=ldc2\n# or\ndub build --config=executable --build=release-nobounds --compiler=ldc2\n```\n\n- Download Native Binaries from\n  https://github.com/aminya/minijson/releases/latest\n\n### CLI Usage\n\n```shell\n# Minify the specified files\nminijson ./dist/**/*.json ./build/a.json\n\n# Minify the specified files (supports comments)\nminijson --comment file1_with_comment.json file2_with_comment.json\n\n# Minify the specified json string\nminijson --str '{\"some_json\": \"string_here\"}'\n\n# Minify the specified json string (supports comments)\nminijson --comment --str '{\"some_json\": \"string_here\"} //comment'\n```\n\n```shell\n\u003e minijson --help\n\nUsage: minijson [--files FILES ...] [--comment] [--str STR ...] [--file FILE ...] [-h]\n\nminijson: minify json files with support for comments\n\nOptional arguments:\n  --files FILES ...\n  --comment\n  --str STR ...\n  --file FILE ...\n  -h, --help           Show this help message and exit\n```\n\n### Node API\n\n```js\nimport { minifyFiles, minifyString } from \"minijson\"\n\n// minify the files in-place and in parallel\nawait minifyFiles([\"file1.json\", \"file2.json\"])\n\n// supports comments by passing true as the second argument\nawait minifyFiles([\"file1_with_comment.json\", \"file2_with_comment.json\"], true)\n\n// minify the given string\nconst minifiedString = minifyString(`{\"some_json\": \"here\"}`)\n\n// supports comments by passing true as the second argument\nconst minifiedString2 = minifyString(`{\"some_json\": \"here\"}//comment`, true)\n```\n\n**Note**: in the Nodejs API, prefer `minifyFiles` over other functions, as it minifies the files in parallel with the least amount of resources.\n\n### D API\n\n```js\nimport minijson: minifyString, minifyFiles;\n\n// minify the given string\nconst minifiedString = minifyString(`{\"some_json\": \"here\"}`);\n\n// supports comments by passing true as the second argument\nconst minifiedString2 = minifyString(`{\"some_json\": \"here\"}//comment`, true);\n\n// minify the files in-place and in parallel\nminifyFiles([\"file1.json\", \"file2.json\"]);\n\n// supports comments by passing true as the second argument\nminifyFiles([\"file1.json\", \"file2.json\"], true);\n```\n\n### Benchmarks\n\nOn AMD Ryzen 7 4800H:\n\n- minifyString: minijson is 4178 times faster than jsonMinify\n- minifyFiles: minijson is 1894 times faster than jsonMinify.\n\n```\n❯ .\\dist\\minijson-benchmark.exe --benchmark-minifyString --benchmark-minifyFiles\nBenchmark minifyString\n14 ms\nBenchmark minifyFiles\n31 ms\n\n❯ node .\\benchmark\\js-benchmark.mjs\nBenchmark minifyString\n58.502 seconds\nBenchmark minifyFiles\n58.703 seconds\n```\n\n### Contributing\n\nYou would need to install the ldc compiler for the D programming language\n\n```\ncurl -fsS https://dlang.org/install.sh | bash -s ldc\n```\n\nAfter installation, it will print a message about activating it. Something like `source activate_ldc.sh`.\n\nAfter running the activation command, clone the repository:\n\n```\ngit clone --recurse-submodules https://github.com/aminya/minijson\ncd minijson\n```\n\nThen build with:\n\n```\npnpm install\npnpm build.node\n```\n\n### License\n\nThe project is licensed under MIT. It was inspired by [fkei/JSON.minify](https://github.com/fkei/JSON.minify).\n","funding_links":["https://github.com/sponsors/aminya","https://polar.sh/aminya","https://patreon.com/aminya"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminya%2Fminijson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faminya%2Fminijson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminya%2Fminijson/lists"}