jarq 0.7.6

An interactive jq-like JSON query tool with a TUI
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Shared utility functions.

use simd_json::OwnedValue as Value;
use simd_json::StaticNode;

/// Get the JSON type name for a value.
pub fn type_name(value: &Value) -> &'static str {
    match value {
        Value::Static(StaticNode::Null) => "null",
        Value::Static(StaticNode::Bool(_)) => "boolean",
        Value::Static(StaticNode::I64(_) | StaticNode::U64(_) | StaticNode::F64(_)) => "number",
        Value::String(_) => "string",
        Value::Array(_) => "array",
        Value::Object(_) => "object",
    }
}