| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 | [[json-processor]]=== JSON processor++++<titleabbrev>JSON</titleabbrev>++++Converts a JSON string into a structured JSON object.[[json-options]].Json Options[options="header"]|======| Name           | Required  | Default  | Description| `field`        | yes       | -        | The field to be parsed| `target_field` | no        | `field`  | The field to insert the converted structured object into| `add_to_root`  | no        | false    | Flag that forces the serialized json to be injected into the top level of the document. `target_field` must not be set when this option is chosen.include::common-options.asciidoc[]|======All JSON-supported types will be parsed (null, boolean, number, array, object, string).Suppose you provide this configuration of the `json` processor:[source,js]--------------------------------------------------{  "json" : {    "field" : "string_source",    "target_field" : "json_target"  }}--------------------------------------------------// NOTCONSOLEIf the following document is processed:[source,js]--------------------------------------------------{  "string_source": "{\"foo\": 2000}"}--------------------------------------------------// NOTCONSOLEafter the `json` processor operates on it, it will look like:[source,js]--------------------------------------------------{  "string_source": "{\"foo\": 2000}",  "json_target": {    "foo": 2000  }}--------------------------------------------------// NOTCONSOLEIf the following configuration is provided, omitting the optional `target_field` setting:[source,js]--------------------------------------------------{  "json" : {    "field" : "source_and_target"  }}--------------------------------------------------// NOTCONSOLEthen after the `json` processor operates on this document:[source,js]--------------------------------------------------{  "source_and_target": "{\"foo\": 2000}"}--------------------------------------------------// NOTCONSOLEit will look like:[source,js]--------------------------------------------------{  "source_and_target": {    "foo": 2000  }}--------------------------------------------------// NOTCONSOLEThis illustrates that, unless it is explicitly named in the processor configuration, the `target_field`is the same field provided in the required `field` configuration.
 |