diff --git a/src/event/format/json.rs b/src/event/format/json.rs index cedbabaa3..3b6b51a51 100644 --- a/src/event/format/json.rs +++ b/src/event/format/json.rs @@ -183,7 +183,9 @@ fn valid_type(data_type: &DataType, value: &Value) -> bool { DataType::Boolean => value.is_boolean(), DataType::Int8 | DataType::Int16 | DataType::Int32 | DataType::Int64 => value.is_i64(), DataType::UInt8 | DataType::UInt16 | DataType::UInt32 | DataType::UInt64 => value.is_u64(), - DataType::Float16 | DataType::Float32 | DataType::Float64 => value.is_f64(), + DataType::Float16 | DataType::Float32 | DataType::Float64 => { + value.is_f64() || value.is_i64() || value.is_u64() + } DataType::Utf8 => value.is_string(), DataType::List(field) => { let data_type = field.data_type(); diff --git a/src/handlers/http/ingest.rs b/src/handlers/http/ingest.rs index f94faefce..d6351f455 100644 --- a/src/handlers/http/ingest.rs +++ b/src/handlers/http/ingest.rs @@ -621,10 +621,10 @@ mod tests { { "a": 1, "b": "hello", - "c": 1 + "c": 1 // All numbers can be cast into float: #989 }, { - "a": 1, + "a": 1.24, // But not the other way round "b": "hello", "c": null },