skip to Main Content

Efficient conversion of json data in R

I use R to process log files of zigbee2mqtt which logs entries like this head(data) [1] "info 2024-03-11 14:08:01: MQTT publish: topic 'zigbee2mqtt/TempBadEG', payload '{"battery":17,"humidity":50.1,"linkquality":105,"temperature":17.25,"voltage":2500}'" [2] "info 2024-03-11 14:08:04: MQTT publish: topic 'zigbee2mqtt/MotionBadOben', payload '{"battery":20,"battery_low":true,"illuminance":37914,"illuminance_lux":12369,"led_control":"off","linkquality":69,"occupancy":false,"occupancy_timeout":60,"tamper":false,"temperature":17,"update":{"installed_version":262147,"latest_version":262146,"state":"idle"},"voltage":2600}'" [3] "info 2024-03-11 14:08:04: MQTT…

VIEW QUESTION

Parse simple JSON into dataframe with R

A seemingly simple JSON file that I would like to parse with R: tmp_extract <- "{"encrypted_values":[{"name_a":"value_a"}, {"name_b":"value_b"}, {"name_c":"value_c"}]}" An attempt with jsonlite::fromJSON produces a dataframe with as many columns as there are names and only a value per column. tmp_extract…

VIEW QUESTION
Back To Top
Search