# nlohmann/json vs RapidJSON: source lines of code compared

The nlohmann/json vs RapidJSON comparison on OctoCounts shows side-by-side source line counts for nlohmann/json and Tencent/rapidjson, counted with the same engine and analysis options on the dates shown in the methodology line: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.

As of 2026-09-08, nlohmann/json contains 63,626 total lines (40,672 code) across 94 files, while Tencent/rapidjson contains 28,891 total lines (21,121 code) across 150 files as of 2026-09-15. nlohmann/json is about 1.9x the size of Tencent/rapidjson by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

| Metric | [nlohmann/json](https://octocounts.com/github/nlohmann/json) | [Tencent/rapidjson](https://octocounts.com/github/Tencent/rapidjson) |
| --- | ---: | ---: |
| Files | 94 | 150 |
| Total lines | 63,626 | 28,891 |
| Code lines | 40,672 | 21,121 |
| Comment lines | 15,310 | 4,579 |
| Blank lines | 7,644 | 3,191 |
| Languages counted | 12 | 12 |

Top languages in nlohmann/json: C++ Header (94.2% of code), CMake (3.3% of code), Python (1.4% of code). Top languages in Tencent/rapidjson: C Header (61.5% of code), JSON (26.7% of code), C++ (9.5% of code). CMake appears in both top language lists; C++ Header, Python, Makefile, Bazel appear only in nlohmann/json's top languages; C Header, JSON, C++, YAML appear only in Tencent/rapidjson's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. nlohmann/json was counted at ref 7b2d73cf2e443adbe7903754f912ed95b42504f1 (commit 7b2d73cf2e44) on 2026-09-08; Tencent/rapidjson was counted at ref ab1842a2dae061284c0a62dca1cc6d5e7e37e346 (commit ab1842a2dae0) on 2026-09-15. See the [counting methodology](https://octocounts.com/docs/methodology) for ignored directories and analysis options.
## About this comparison

nlohmann/json counts the nlohmann/json repository: a C++ JSON library best known for its single-header distribution, with the generating source, tests, documentation, and benchmarks in the same tree. Tencent/rapidjson counts the RapidJSON repository: a multi-header C++ JSON library with its own test suite and benchmarks. Both are header-oriented C++ libraries, counted on the dates shown above.

Both counted archives are overwhelmingly C++ in the per-language table, so this is a like-for-like language comparison; the totals differ mainly in how each project organizes and regenerates its headers.

nlohmann/json's repository contains the amalgamation tooling that produces its single-header release artifact, while RapidJSON ships an include/ tree of separate headers — two different repo shapes for the same library category, both visible in the file layout of each report.

_Header-library line counts do not track parsing speed, binary size, or compile-time cost in your build; benchmarks and your own measurements are the right tool for that, not these totals._

Sources: [nlohmann/json repository (single-header C++ JSON library)](https://github.com/nlohmann/json) · [Tencent/rapidjson repository (multi-header C++ JSON library)](https://github.com/Tencent/rapidjson). Statements verified 2026-09-16.

Evidence and next steps:

- [nlohmann/json SLOC report](https://octocounts.com/github/nlohmann/json)
- [Tencent/rapidjson SLOC report](https://octocounts.com/github/Tencent/rapidjson)
- [Compare nlohmann/json and Tencent/rapidjson interactively](https://octocounts.com/compare?left=https%3A%2F%2Fgithub.com%2Fnlohmann%2Fjson&right=https%3A%2F%2Fgithub.com%2FTencent%2Frapidjson)

Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.

## Compare FAQ

### Which has more lines of code, nlohmann/json or Tencent/rapidjson?

nlohmann/json has more code: 40,672 code lines versus 21,121 for Tencent/rapidjson, about 1.9x as much, based on cached OctoCounts reports as of 2026-09-15.

### Does more source lines of code mean more complexity?

Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for nlohmann/json, Tencent/rapidjson, or any repository.

### How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. nlohmann/json was counted at ref 7b2d73cf2e443adbe7903754f912ed95b42504f1 (commit 7b2d73cf2e44) on 2026-09-08; Tencent/rapidjson was counted at ref ab1842a2dae061284c0a62dca1cc6d5e7e37e346 (commit ab1842a2dae0) on 2026-09-15. See the counting methodology for ignored directories and analysis options.

### Can I compare a different branch, tag, or commit?

Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.

## Related OctoCounts pages

- [Interactive repository comparison](https://octocounts.com/compare)
- [Recently analyzed repositories](https://octocounts.com/recent)
- [Popular SLOC reports](https://octocounts.com/popular)
- [Trending GitHub repositories](https://octocounts.com/trending)
- [Hall of Monoliths](https://octocounts.com/hall-of-monoliths)
- [Original research: how filtering changes SLOC counts](https://octocounts.com/research)
- [GitHub SLOC counter guide](https://octocounts.com/docs/github-sloc-counter)
- [Counting methodology](https://octocounts.com/docs/methodology)
- [SLOC and code metrics glossary](https://octocounts.com/docs/glossary)
- [OctoCounts API docs](https://octocounts.com/docs/api)
