Get a Vec from an Array of Json
(value: serde_json::Value)
| 1368 | |
| 1369 | /// Get a Vec<Self> from an Array of Json |
| 1370 | fn from_json_vec(value: serde_json::Value) -> Result<Vec<Self>, TryGetError> { |
| 1371 | match value { |
| 1372 | serde_json::Value::Array(values) => { |
| 1373 | let mut res = Vec::new(); |
| 1374 | for item in values { |
| 1375 | res.push(serde_json::from_value(item).map_err(crate::error::json_err)?); |
| 1376 | } |
| 1377 | Ok(res) |
| 1378 | } |
| 1379 | _ => Err(TryGetError::DbErr(DbErr::Json( |
| 1380 | "Value is not an Array".to_owned(), |
| 1381 | ))), |
| 1382 | } |
| 1383 | } |
| 1384 | } |
| 1385 | |
| 1386 | #[cfg(feature = "with-json")] |
nothing calls this directly
no test coverage detected