github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/processors/process_field.md (about) 1 --- 2 title: process_field 3 type: processor 4 status: deprecated 5 --- 6 7 <!-- 8 THIS FILE IS AUTOGENERATED! 9 10 To make changes please edit the contents of: 11 lib/processor/process_field.go 12 --> 13 14 import Tabs from '@theme/Tabs'; 15 import TabItem from '@theme/TabItem'; 16 17 :::warning DEPRECATED 18 This component is deprecated and will be removed in the next major version release. Please consider moving onto [alternative components](#alternatives). 19 ::: 20 21 A processor that extracts the value of a field [dot path](/docs/configuration/field_paths) 22 within payloads according to a specified [codec](#codec), applies a list of 23 processors to the extracted value and finally sets the field within the original 24 payloads to the processed result. 25 26 27 <Tabs defaultValue="common" values={[ 28 { label: 'Common', value: 'common', }, 29 { label: 'Advanced', value: 'advanced', }, 30 ]}> 31 32 <TabItem value="common"> 33 34 ```yaml 35 # Common config fields, showing default values 36 label: "" 37 process_field: 38 codec: json 39 path: "" 40 result_type: string 41 processors: [] 42 ``` 43 44 </TabItem> 45 <TabItem value="advanced"> 46 47 ```yaml 48 # All config fields, showing default values 49 label: "" 50 process_field: 51 codec: json 52 path: "" 53 result_type: string 54 processors: [] 55 parts: [] 56 ``` 57 58 </TabItem> 59 </Tabs> 60 61 The result can be marshalled into a specific data type with the field 62 [`result_type`](#result_type). 63 64 It's therefore possible to use this codec without any child processors as a way 65 of casting string values into other types. For example, with an input JSON 66 document `{"foo":"10"}` it's possible to cast the value of the 67 field foo to an integer type with: 68 69 ```yaml 70 process_field: 71 path: foo 72 result_type: int 73 ``` 74 75 ## Codecs 76 77 ### `json` 78 79 Parses the payload as a JSON document, extracts and sets the field using a dot 80 notation path. 81 82 ### `metadata` 83 84 Extracts and sets a metadata value identified by the path field. 85 86 ## Fields 87 88 ### `codec` 89 90 A [codec](#codec) to use in order to extract (and set) the target field. 91 92 93 Type: `string` 94 Default: `"json"` 95 Options: `json`, `metadata`. 96 97 ### `path` 98 99 A [dot path](/docs/configuration/field_paths) pointing to the target field. 100 101 102 Type: `string` 103 Default: `""` 104 105 ### `result_type` 106 107 The final data type to marshal the processing result into. The `discard` type is a special case that discards the result of the processing steps entirely. 108 109 110 Type: `string` 111 Default: `"string"` 112 Options: `string`, `int`, `float`, `bool`, `object`, `discard`. 113 114 ### `processors` 115 116 A list of child processors to execute on the extracted value. 117 118 119 Type: `array` 120 Default: `[]` 121 122 ### `parts` 123 124 An optional array of message indexes of a batch that the processor should apply to. 125 If left empty all messages are processed. This field is only applicable when 126 batching messages [at the input level](/docs/configuration/batching). 127 128 Indexes can be negative, and if so the part will be selected from the end 129 counting backwards starting from -1. 130 131 132 Type: `array` 133 Default: `[]` 134 135 ## Alternatives 136 137 The [`branch` processor](/docs/components/processors/branch) offers a 138 more flexible and robust way to perform the actions of this processor. 139