You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Refactor] Replace custom JSON parser in cli_support.cpp with nlohmann::json #963
While exploring the configuration parsing logic in src/runtime/config/cli_support.cpp, I noticed that the file implements its own custom "Tiny JSON parser" (the Parser struct) along with several custom manual JSON string serializers and string scanners (match_object_end, etc.).
Since the project already includes and heavily relies on the robust nlohmann/json library in other core components (such as the tokenizers and plugins), maintaining a custom 300+ line JSON parser specifically for the CLI configuration is unnecessary. It increases technical debt, adds unnecessary binary size, and is prone to edge-case parsing bugs compared to a fully standard-compliant library.
Motivation & Context
Replacing this custom implementation with nlohmann::json will:
Reduce Code Complexity: Eliminate over 300 lines of custom string manipulation and scanning logic.
Increase Robustness: Delegate JSON parsing to a well-tested, standard-compliant library.
Unify Dependencies: Ensure JSON parsing is handled consistently across the entire TensorRT-Model-Connect codebase.
Proposed outcome
Proposed Solution
Remove the custom Parser struct from cli_support.cpp.
Activity
yifeif-nv commentedon Aug 21, 2026
Looks good. Thanks for raising the PR and the contribution! I love those kinds of PRs that remove code rather than adding more.
yifeif-nv commentedon Aug 21, 2026
I'll leave this issue open until the remaining related issues are addressed
chaofengw-nv commentedon Aug 21, 2026
@kanhaiya-dct Thanks for your contribution. Inspired by this, I have re‑checked some similar cases and filed relevant issues for tracking.