| 313 | // right after a JSON string boundary and the "identifier" is |
| 314 | // probably part of a value continuation (e.g. `"k": foo: 1` would |
| 315 | // be malformed JSON anyway, but better to leave it untouched). |
| 316 | std::smatch m; |
| 317 | std::string tail = payload.substr(i); |
| 318 | if (std::regex_search(tail, m, re_bare_key, |
| 319 | std::regex_constants::match_continuous) && |
| 320 | (rewritten.empty() || rewritten.back() != '"')) { |
| 321 | rewritten += '"'; |
| 322 | rewritten += m[1].str(); |
| 323 | rewritten += '"'; |
| 324 | rewritten += m[2].str(); |
| 325 | i += m.length(); |
| 326 | continue; |
| 327 | } |
| 328 | rewritten += c; |
| 329 | i++; |
| 330 | } |
| 331 | |
| 332 | json parsed = json::parse(rewritten, nullptr, false); |
| 333 | if (parsed.is_discarded()) return false; |
| 334 | out = std::move(parsed); |
| 335 | return true; |
| 336 | } |
| 337 | |
| 338 | |
| 339 | // ─── XML parameter parser ─────────────────────────────────────────────── |
| 340 | |
| 341 | static json parse_xml_params(const std::string & region, const std::string & fn_name, |
no test coverage detected