Your a) and b) solutions are not exclusive. Since the JS in JSON stands for JavaScript, using JSON to transmit data just means writing it in a JavaScript format. So if you embed that JSON output in the code somewhere, that's your solution one.
Outputing JSON with perl is ridiculously easy with the JSON module: use JSON; my $json = encode_json $nested_arrays_and_hashes; (or to_json, both are not stricly equivalent, but you can do a bit of documentation reading :) ). Once your data is in an easy to use format, you have to decide weither you want it to be statically embeded in the pages' code, or if it should be fetched asynchronously