function::json_add_numeric_metric - Linux


Overview

The function::json_add_numeric_metric function creates a new numeric metric in a JSON object.

Syntax

json_add_numeric_metric(json_object, path, value)
  • json_object: The JSON object to add the metric to.
  • path: The path to the metric within the JSON object.
  • value: The value of the metric.

Options/Flags

None.

Examples

The following example creates a new numeric metric called "score" with a value of 90 in the JSON object json:

use crate::function::json_add_numeric_metric;

fn main() {
    let mut json = json!({});
    json_add_numeric_metric(&mut json, "score", 90);

    println!("{}", json);
}

Output:

{"score": 90}

Common Issues

None.

Integration

The function::json_add_numeric_metric function can be used with other JSON processing functions to create complex JSON objects.

Related Commands

  • json_add_string_metric: Adds a string metric to a JSON object.
  • json_add_boolean_metric: Adds a boolean metric to a JSON object.
  • json_add_null_metric: Adds a null metric to a JSON object.