jsoncpp: modernize Reader/Writer to the 1.x builder API (post-vcpkg-migration)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 208
- PR merge metrics
- No merged PRs in 30d
Description
Follow-up to the jsoncpp vcpkg migration (#179). The migration is done in two steps:
- Step 1 (vcpkg move): migrate
//thirdparty/jsoncppto vcpkg jsoncpp 1.9.x, keeping flare's existingJson::Reader/FastWriter/StyledWriterusage and silencing their deprecation with-Wno-deprecated-declarationson the consuming targets. This isolates the library/version change from any API rewrite. - Step 2 (this issue): replace the deprecated APIs with the 1.x builder API so we can drop the warning suppression (and stay compatible past jsoncpp's eventual removal of the legacy classes).
Scope
Deprecated APIs are used in ~23 files / ~12 targets (http builtin handlers, binlog, base/option, monitoring, plus tests):
Json::Reader(≈21 sites) →Json::CharReaderBuilder+Json::parseFromStream/CharReader::parse.Json::FastWriter(≈4) /Json::StyledWriter(≈8) →Json::StreamWriterBuilder+Json::writeString.
Behavioral pitfalls to handle in the rewrite
FastWriter::write()appends a trailing\n;writeString()does not.StreamWriterBuilderdefaults to pretty output — setbuilder["indentation"]=""for compact. Update golden/string-compare tests accordingly.- 1.x throws
Json::LogicError/RuntimeErroron type misuse (e.g.asString()on a non-string) where 0.x coerced/defaulted. - 1.x parsing is stricter; revisit any inputs relying on 0.x leniency.
Optional cleanup
- Switch includes from flare's
jsoncpp/<h>alias to the canonicaljson/<h>and drop theinclude_prefix={'jsoncpp':'json'}mapping added in Step 1.
🤖 Generated with Claude Code
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the deprecated Json::Reader, FastWriter, and StyledWriter uses across the http builtin handlers, binlog, base/option, monitoring, and tests. Start by tracing each use and its existing string or golden-test expectations. Replace the APIs with the 1.x builders, preserve compact output and trailing-newline behavior, update affected comparisons, and verify the warning suppression can be removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100