# \[PHP\] Problems with JSON processor

**URL:** <https://discuss.elastic.co/t/php-problems-with-json-processor/65385>\
**Category:** Elasticsearch\
**Created:** [November 8, 2016, 5:40pm UTC](https://discuss.elastic.co/t/php-problems-with-json-processor/65385 "2016-11-08T17:40:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![evert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/evert/32/8143_2.png) [@evert](https://discuss.elastic.co/u/evert)\
**Post date:** [November 8, 2016, 5:40pm UTC](https://discuss.elastic.co/t/php-problems-with-json-processor/65385/1 "2016-11-08T17:40:53Z")

</div>

I am having some problems to make JSON proccessor work.

Here is what I am trying, as of [docs](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/json-processor.html):

```
$params = [
    'id' => 'encode_json',
    'body' => [
        'description' => 'Extract attachment information',
        'processors' => [
            [
                'json' => [
                    'field' => '{{ authors }}',
                    'target_field' => 'attachment.authors'
                ]
            ],

        ]
    ]
];
return $client->ingest()->putPipeline($params);

```

Some other processor are already working, as below:

```
$params = [
    'id' => 'attachment',
    'body' => [
        'description' => 'Extract attachment information',
        'processors' => [
            [
                'attachment' => [
                    'field' => 'content',
                    'indexed_chars' => -1
                ]                        
            ],
            [
                'set' => [
                    'field' => 'attachment.author',
                    'value' => '{{ author }}'
                ]
            ],
            [
                'remove' => [
                    'field' => 'author'
                ]
            ],
            ]
        ]
    ]
];
return $client->ingest()->putPipeline($params);

```

But when it comes to the _attachment.author_ it brings as string... I need as json/array.

I am using ES 5.0 with ES oficial PHP Client.

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 6, 2016, 5:41pm UTC](https://discuss.elastic.co/t/php-problems-with-json-processor/65385/2 "2016-12-06T17:41:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
