Browse Source

Match Go Query: quote JSON keys in output records

Go's ToJson produces valid JSON with quoted keys like {"name":"Alice"}.
Rust was producing invalid JSON with unquoted keys like {name:"Alice"}.
rust-volume-server
Chris Lu 3 days ago
parent
commit
8063788e13
  1. 4
      seaweed-volume/src/server/grpc_server.rs

4
seaweed-volume/src/server/grpc_server.rs

@ -3393,13 +3393,15 @@ impl VolumeServer for VolumeGrpcService {
}
}
// Build output record: {selection:value,...} (Go's ToJson format)
// Build output record: {"selection":value,...} (Go's ToJson format)
records.push(b'{');
for (i, sel) in req.selections.iter().enumerate() {
if i > 0 {
records.push(b',');
}
records.push(b'"');
records.extend_from_slice(sel.as_bytes());
records.push(b'"');
records.push(b':');
let val = &parsed[sel];
let raw = if val.is_null() {

Loading…
Cancel
Save