NAME
Protocol::IR::Format::JSON - proprietary JSON IR database dump import
VERSION
version 1.2
SYNOPSIS
use Protocol::IR::Converter;
my $converter = Protocol::IR::Converter->new();
# Import a command-set document (file path or JSON string)
my $codes = $converter->import_format('JSON', 'codeset.json');
for my $code (@$codes) {
print $code->alias . " (" . $code->protocol . ")\n";
}
# Import a device document, which points at its command set
my $device = $converter->import_format('JSON', 'devices/JVC/EM40NF5.json');
# The wig entry point accepts the same documents interchangeably
my $also = $converter->import_format('wig', 'codeset.json');
DESCRIPTION
Protocol::IR::Format::JSON imports the JSON documents of a proprietary IR database dump. A command-set document is a commands list, each entry carrying a name and a raw pronto Pronto hex payload plus opaque keycode/protocol strings. A device document instead carries a codeset path pointing at the re-usable command set that every device with those commands shares; the path is relative to the dump root, so it is resolved by walking up from the device file's own directory. Either way the payloads are the Pronto hex a wig carries, so the imported codes are identical to what import_format('wig', ...) would produce, and the wig importer accepts these shapes automatically. Commands with no Pronto payload are skipped rather than failing the import. Dies with a concrete reason if the JSON is malformed, a command is missing its name, or a payload cannot be decoded.
Import-only: the keycode/protocol strings are the dump's own naming, so the format is never exported.
METHODS
decode
my $codes = $class->decode($input, $registry);
Parses a file path or JSON string and returns an arrayref of Protocol::IR::Code objects, one per command with a Pronto payload, with alias set from the command name and send_count set from the repeat hint the keycode carries after its last colon.
SUPPORT
Source code: https://github.com/bwarden/perl-protocol-ir
Bug reports and feature requests: https://github.com/bwarden/perl-protocol-ir/issues
AUTHOR
Brett T. Warden <bwarden@cpan.org>
COPYRIGHT AND LICENSE
Copyright (c) 2026 Brett T. Warden
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.