@@ -110,21 +110,19 @@ impl ReadService for ReadGrpcService {
110
110
} ) ?;
111
111
112
112
return Ok ( Response :: new ( GetObjectResponse {
113
- json_data : Some ( crate :: common:: JsonData {
114
- data : serde_json:: to_vec ( & data) . map_err ( |e| {
115
- Status :: internal ( format ! (
116
- "Failed to serialize object data: {e}"
117
- ) )
118
- } ) ?,
119
- } ) ,
120
- json_error : Some ( crate :: common:: JsonData {
121
- data : serde_json:: to_vec ( & IotaObjectResponseError :: Display {
113
+ json_data : Some ( serde_json:: to_string ( & data) . map_err ( |e| {
114
+ Status :: internal ( format ! (
115
+ "Failed to serialize object data: {e}"
116
+ ) )
117
+ } ) ?) ,
118
+ json_error : Some (
119
+ serde_json:: to_string ( & IotaObjectResponseError :: Display {
122
120
error : "Failed to compute display fields" . to_string ( ) ,
123
121
} )
124
122
. map_err ( |e| {
125
123
Status :: internal ( format ! ( "Failed to serialize error: {e}" ) )
126
124
} ) ?,
127
- } ) ,
125
+ ) ,
128
126
} ) ) ;
129
127
}
130
128
}
@@ -159,23 +157,23 @@ impl ReadService for ReadGrpcService {
159
157
160
158
/// Serialize success data to JSON (matches IotaObjectResponse::new_with_data)
161
159
fn serialize_data_to_json ( data : IotaObjectData ) -> Result < GetObjectResponse , Status > {
162
- let json_data = serde_json:: to_vec ( & data)
160
+ let json_data = serde_json:: to_string ( & data)
163
161
. map_err ( |e| Status :: internal ( format ! ( "Failed to serialize object data to JSON: {e}" ) ) ) ?;
164
162
165
163
Ok ( GetObjectResponse {
166
- json_data : Some ( crate :: common :: JsonData { data : json_data } ) ,
164
+ json_data : Some ( json_data) ,
167
165
json_error : None ,
168
166
} )
169
167
}
170
168
171
169
/// Serialize error to JSON (matches IotaObjectResponse::new_with_error)
172
170
fn serialize_error_to_json ( error : IotaObjectResponseError ) -> Result < GetObjectResponse , Status > {
173
- let error_data = serde_json:: to_vec ( & error)
171
+ let json_error = serde_json:: to_string ( & error)
174
172
. map_err ( |e| Status :: internal ( format ! ( "Failed to serialize error to JSON: {e}" ) ) ) ?;
175
173
176
174
Ok ( GetObjectResponse {
177
175
json_data : None ,
178
- json_error : Some ( crate :: common :: JsonData { data : error_data } ) ,
176
+ json_error : Some ( json_error ) ,
179
177
} )
180
178
}
181
179
0 commit comments