Decode a Data Plane response payload to JSON. Tries MessagePack first (primary format), then JSON passthrough.
(payload: &[u8])
| 274 | /// |
| 275 | /// Tries MessagePack first (primary format), then JSON passthrough. |
| 276 | fn decode_payload_to_json(payload: &[u8]) -> Result<serde_json::Value, ()> { |
| 277 | // Try MessagePack. |
| 278 | if let Ok(val) = nodedb_types::json_from_msgpack(payload) { |
| 279 | return Ok(val); |
| 280 | } |
| 281 | |
| 282 | // Try JSON passthrough. |
| 283 | if let Ok(val) = sonic_rs::from_slice::<serde_json::Value>(payload) { |
| 284 | return Ok(val); |
| 285 | } |
| 286 | |
| 287 | Err(()) |
| 288 | } |
| 289 | |
| 290 | /// Convert pgwire Response vec to JSON rows (for DDL results). |
| 291 | fn responses_to_json(responses: Vec<pgwire::api::results::Response>) -> Vec<serde_json::Value> { |