partial-json-parser icon indicating copy to clipboard operation
partial-json-parser copied to clipboard

Request for C++ Implementation

Open yingxudeng opened this issue 4 months ago • 3 comments

Hello,

Thank you for your great work on this project! I would like to ask if it is possible to provide a C++ implementation of the current functionality. It would be very helpful for users who work primarily with C++.

Looking forward to your response. Thank you!

yingxudeng avatar Aug 15 '25 10:08 yingxudeng

I'm not a C++ expert myself, but contributions are always welcome! ❤️

For reference, there are existing implementations in Go that might be helpful. I also maintain Python and JavaScript implementations, although I should note that the Python version now has many Python-specific optimizations for micro performance, so it might not be the best reference point.

  • Out of curiosity, what's the use case for parsing LLM JSON output in C++? I'd love to hear more about your project.

CNSeniorious000 avatar Aug 16 '25 08:08 CNSeniorious000

You can feed the Go implementation and my JavaScript implementation to LLM agents like Claude or Code and see if they can help generate a C++ version as a starting point. And then you can let it migrate the test suite from my Python implementation, which includes both typical edge cases and property tests. Good luck!

CNSeniorious000 avatar Aug 16 '25 08:08 CNSeniorious000

Thank you for your quick and detailed response!

We're developing a high-performance, pure C++ LLM inference engine where performance is absolutely critical. One of the key requirements is the ability to handle streaming tool calls, which involves parsing incomplete/incremental JSON strings - exactly what your project solves so elegantly.

We were very excited to discover your work as it perfectly addresses our needs for partial JSON parsing, but unfortunately couldn't find a C++ implementation that we could integrate into our all-C++ pipeline.

yingxudeng avatar Aug 17 '25 07:08 yingxudeng