How to remove special character from string in logstash

I have another question related to same . I have 100 filed names values like "|g" and field names come like below
"attributes": {
"m_host_mem_mem_cache": "2.0229201920e+09|g",
"m_host_mem_mem_free": "3.8571212800e+09|g",
"m_host_mem_free_mem_swap": "1.9327344640e+10|g",
"m_host_mem_file_buffer": "8.2237849600e+08|g",
"m_host_mem_mem_total": "8.0994344960e+09|g",
"m_host_mem_mem_swap": "1.9327344640e+10|g"
},
How can I use iterator and dynamic replacement "|g" with empty and convert the float. Please give me solution.