# How to mutate convert field in Json file input

**URL:** <https://discuss.elastic.co/t/how-to-mutate-convert-field-in-json-file-input/87327>\
**Category:** Logstash\
**Created:** [May 27, 2017, 8:01am UTC](https://discuss.elastic.co/t/how-to-mutate-convert-field-in-json-file-input/87327 "2017-05-27T08:01:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tal\_Bar\_Or](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tal_bar_or/32/5127_2.png) [@Tal\_Bar\_Or](https://discuss.elastic.co/u/Tal_Bar_Or)\
**Post date:** [May 27, 2017, 8:01am UTC](https://discuss.elastic.co/t/how-to-mutate-convert-field-in-json-file-input/87327/1 "2017-05-27T08:01:24Z")

</div>

Hi,

I am reading Json file and trying to mutate/convert some fields to float for example , but its not working for me.  
Its seems that i am missing the right way doing so ,below i have my config file and json example structure  
Please advise  
Thanks

=========config file===========  
input{  
exec{  
command =\> "C:/dst/smbtest.json"  
codec =\> json  
interval =\> 180  
}  
}  
filter{  
mutate{  
#convert =\> { "frame.time\_relative" =\> "float" }  
convert =\> {"[\_index]{[\_source]{[layers][frame.time\_relative]}}}" =\> "float"}  
}

```
    }
    output{
      stdout{codec => json}
    }

```

==========json file===================================================  
[  
{  
"\_index": "packets-2017-05-22",  
"\_type": "pcap\_file",  
"\_score": null,  
"\_source": {  
"layers": {  
"frame.number": ["26"],  
"frame.time\_relative": ["1.560480000"],  
"ip.src": ["172.23.136.73"],  
"ip.dst": ["172.23.254.88"],  
"tcp.flags.syn": ["1"],  
"tcp.flags.ack": ["0"]  
}  
}  
}

```
  ,
  {
    "_index": "packets-2017-05-22",
    "_type": "pcap_file",
    "_score": null,
    "_source": {
      "layers": {
        "frame.number": ["27"],
        "frame.time_relative": ["1.560558000"],
        "ip.src": ["10.10.1.1"],
        "ip.dst": ["172.23.254.88"],
        "tcp.flags.syn": ["1"],
        "tcp.flags.ack": ["0"]
      }
    }
  }

  ,
  {
    "_index": "packets-2017-05-22",
    "_type": "pcap_file",
    "_score": null,
    "_source": {
      "layers": {
        "frame.number": ["28"],
        "frame.time_relative": ["1.560616000"],
        "ip.src": ["172.23.136.73"],
        "ip.dst": ["172.23.254.88"],
        "tcp.flags.syn": ["1"],
        "tcp.flags.ack": ["0"]
      }
    }
  }
]
```

---

<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:** [June 24, 2017, 8:01am UTC](https://discuss.elastic.co/t/how-to-mutate-convert-field-in-json-file-input/87327/2 "2017-06-24T08:01:36Z")

</div>

Closed on June 24, 2017, 8:01am UTC

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