[−][src]Struct automaat_processor_json_edit::JsonEdit
The processor configuration.
Fields
json: String
The JSON string that will be parsed by the program
value.
program: String
The program to run against the provided json
string.
A program can either filter the JSON down to a subset of data, or can mutate the data before returning a value.
To learn about the supported syntax, see the jq
documentation:
https://stedolan.github.io/jq/manual/v1.6/
pretty_output: bool
"Pretty print" the JSON output.
If set to false, the JSON will be printed in a compact format, without any indentation, spacing or newlines.
Trait Implementations
impl Eq for JsonEdit
[src]
impl PartialEq<JsonEdit> for JsonEdit
[src]
impl Clone for JsonEdit
[src]
fn clone(&self) -> JsonEdit
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for JsonEdit
[src]
impl<'a> Processor<'a> for JsonEdit
[src]
const NAME: &'static str
[src]
type Error = Error
If a processor fails its intended purpose, the returned error is turned into a string, and shown in the automaat-web-client
application. Read more
type Output = String
The processor can return any (successful) output it wants, as long as that type implements the [std::fmt::Display
] trait. Read more
fn validate(&self) -> Result<(), Self::Error>
[src]
Validate that the provided program
syntax is valid.
Errors
If the program contains invalid syntax, the Error::Json
error
variant is returned.
fn run(&self, _context: &Context) -> Result<Option<Self::Output>, Self::Error>
[src]
Run the provided program
against the json
data.
Output
If the final output is a string, the surrounding JSON quotes are removed. This makes it easier to show raw strings in the UI, without having to use the regex processor to remove extra quotes.
This output:
"world"
Becomes this:
world
If pretty_output
is set, any JSON object or array is pretty printed,
by including newlines, indentation and spacing around the key/value
pairs.
This output:
{"hello":"world"}
Becomes this:
{
"hello": "world"
}
When unwrapping arrays in the program, each line is processed according to the above rules.
So this output:
[{"hello":"world"},"hello",2]
Becomes this:
{"hello":"world"}
hello
2
When using the program .[]
.
Errors
This method returns the Error::Json
error variant if the provided
json
input or the program
has invalid syntax.
The Error::Serde
error variant is returned if the processor failed
to serialize or deserialize the input/output JSON.
impl<'de> Deserialize<'de> for JsonEdit
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for JsonEdit
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,