#!/usr/bin/perl -w use JSON; my $json; @{$json->{data}} = (); open SENSORS, ('){ next unless (/^(\w+)(\s+)?=(\s+)?(.*)!(\-?\d+)!(\-?\d+)$/); my ($sensor,$threshigh,$threslow) = ($1,$5,$6); push @{$json->{data}}, { "{#SENSORNAME}" => $sensor, "{#SENSORTHRESHIGH}" => $threshigh, "{#SENSORTHRESLOW}" => $threslow }; } close SENSORS; print to_json($json); exit(0);