Script to modify payload received


#1

Hi I post a rest api with this payload:

{“Time”:“2018-12-21T07:49:23”,“BME680”:{“Temperature”:20.3,“Humidity”:41.8,“Pressure”:1021.1,“Gas”:286.65}

but I need to modfy payload before it will be insert it into mysql database.
I need a java scritp that can pre process a post query (mysql._table.{table_name}.post.pre_process) that transform my received payload from this:

{“Time”:“2018-12-21T07:49:23”,“BME680”:{“Temperature”:20.3,“Humidity”:41.8,“Pressure”:1021.1,“Gas”:286.65}

to this:

{“Time”:“2018-12-21T07:49:23”,“Temperature”:20.3,“Humidity”:41.8,“Pressure”:1021.1,“Gas”:286.65}

How can I acive this ?


#2

Hi @luca,

Our scripting engine currently supports PHP, Node.JS, V8, and Python. We do not currently support Java scripting.

Best,
Kevin


#3

Yes sorry no java, php could be ok as well.