I receive some json over Mqtt, some of the fields are Dates how do i parse them so that the field is a date and not a string? the format is 2018-06-11T15:06:57.092Z
. also one field is a enum in camelCase
is there any way to convert it to snake_case
?
Also the fields are in camelCase
i want to convert the following
{"id":"1500adde-205d-7828-08d5-c36472f2c8ba","canceled":false,"advertisedTimeAtLocation":"2018-06-11T16:02:00","estimatedTimeAtLocation":null,"timeAtLocation":"2018-06-11T16:03:00","otherInformation":"","deviations":"","modifiedTime":"2018-06-11T14:03:54.497Z","state":"onTime","numberOfMinutesDelayed":null
to
{"id":"1500adde-205d-7828-08d5-c36472f2c8ba","canceled":false,"advertised_time_at_location":"2018-06-11 16:02:00","estimated_time_at_location":null,"time_at_location":"2018-06-11 16:03:00","other_information":"","deviations":"","modified_time":"2018-06-11 14:03:54.497Z","state":"on_time","number_of_minutes_delayed":null
current config:
- platform: mqtt
name: "Peter train to work"
state_topic: "trafikverket/peter_train_to_work"
value_template: "{{ value_json.state }}"
payload_available: "online"
payload_not_available: "offline"
json_attributes:
- id
- canceled
- advertisedTimeAtLocation
- estimatedTimeAtLocation
- timeAtLocation
- otherInformation
- deviations
- modifiedTime