pub fn json_to_vector(json: Value) -> Result<Vector2<f64>, simple_error::SimpleError> {
Ok(
Vector2::new(
match json["x"].as_f64() { // as_f64, as_i64, and as_u64 are implemented
Some(v) => v,
None => return Err(simple_error::SimpleError::new("function json_to_vector failed to get x value from json".to_owned()))
},
match json["y"].as_f64() { // as_f64, as_i64, and as_u64 are implemented
Some(v) => v,
None => return Err(simple_error::SimpleError::new("function json_to_vector failed to get y value from json".to_owned()))
}
)
)
}