Skip to content

Commit

Permalink
parse json in quaint
Browse files Browse the repository at this point in the history
  • Loading branch information
Druue committed May 23, 2024
1 parent 1ea54b7 commit 1994310
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion query-engine/driver-adapters/src/conversion/js_to_quaint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,15 @@ pub fn js_value_to_quaint(
// DbNull
serde_json::Value::Null => Ok(QuaintValue::null_json()),
// JsonNull
serde_json::Value::String(s) if s == "$__prisma_null" => Ok(QuaintValue::json(serde_json::Value::Null)),
serde_json::Value::String(s) => {
if s == "$__prisma_null" {
Ok(QuaintValue::json(serde_json::Value::Null))
} else {
serde_json::from_str(&s)
.map_err(|_| conversion_error!("Failed to parse json"))
.map(QuaintValue::json)
}
}
json => Ok(QuaintValue::json(json)),
}
}
Expand Down

0 comments on commit 1994310

Please sign in to comment.