Crate automaat_processor_json_edit

Source
Expand description

An Automaat processor to run a jq program against a JSON string.

You can use this processor to manipulate JSON strings provided by another processor.

This is a very powerful and versatile processor, courtesy of the jq library. It allows you do filter data, manipulate data, or return boolean values that can be used in the next processor to decide its output.

§Example

Take the value of the hello key, and uppercase the ASCII characters.

use automaat_core::{Context, Processor};
use automaat_processor_json_edit::JsonEdit;

let context = Context::new()?;

let processor = JsonEdit {
    json: r#"{"hello":"world"}"#.to_owned(),
    program: ".hello | ascii_upcase".to_owned(),
    pretty_output: false,
};

let output = processor.run(&context)?;

assert_eq!(output, Some("WORLD".to_owned()));

§Package Features

  • juniper – creates a set of objects to be used in GraphQL-based requests/responses.

Structs§

JsonEdit
The processor configuration.

Enums§

Error
Represents all the ways that JsonEdit can fail.