<div dir="ltr">clangd communicates with an editor via JSON-RPC. It parses JSON with YAMLParser, which is awkward, and generates JSON with printf and friends, which is miserable. Much of LLVM does things this way, but clangd does it a lot.<div><br></div><div>I'd like to try replacing this with a JSON library. nlohmann/json[1] seems like a reasonable fit: C++11 with exceptions optional, simple build, MIT license.</div><div><br></div><div>I'd propose vendoring it under tools/clang/tools/extra/clangd/nlohmann-json so there's no question of it "leaking" into runtimes as described in this thread[2].</div><div>This also means it wouldn't solve llvm's general JSON-parser problem :-)</div><div> </div><div>Any LLVM-level objections or concerns? (Whether that library is the right technical choice for clangd can be discussed elsewhere, I think)</div><div>If anyone wants to argue that we *shouldn't* bury it in clang/tools/extra/clangd, that's fine too!</div><div><br></div><div>Cheers, Sam</div><div><br></div><div>[1] <a href="https://github.com/nlohmann/json/blob/develop/src/json.hpp">https://github.com/nlohmann/json/blob/develop/src/json.hpp</a></div><div>[2] <a href="https://groups.google.com/d/msg/llvm-dev/2JHX3smXTpE/U-E32Yg0AAAJ">https://groups.google.com/d/msg/llvm-dev/2JHX3smXTpE/U-E32Yg0AAAJ</a></div></div>