#automation #automaat #processor #json #edit #string #syntax

automaat-processor-json-edit

JSON Editor processor for the Automaat automation utility

1 unstable release

0.1.0 Jun 22, 2019

#439 in Text editors

MIT/Apache

25KB
323 lines

Automaat Processor: JSON Edit

Use jq syntax to filter and manipulate JSON strings.

🚧 Work In Progress 🚧


lib.rs:

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.

Dependencies

~3–15MB
~211K SLoC