terrana 0.1.1

Zero-config spatial API server — point it at a CSV, Parquet, or GeoJSON file and get a REST API with spatial and geometry queries.
1
2
3
4
5
6
7
8
9
10
use crate::error::AppError;
use axum::http::header;
use axum::response::{IntoResponse, Response};
use serde_json::Value;

pub fn to_json_response(rows: &[Value]) -> Result<Response, AppError> {
    let body = serde_json::to_string(rows)
        .map_err(|e| AppError::Internal(anyhow::anyhow!("JSON serialization error: {}", e)))?;
    Ok(([(header::CONTENT_TYPE, "application/json")], body).into_response())
}