Morse code decoder

A JSON file to help decode morse-code


It's not often people need to decode text into morse code (and visa-versa), but if I had something like this when I needed to, it would have saved me hours of time!

I originally needed this for the Student Robotics 2015 entry, to convert a string message into morse code that would be transmitted using LEDs, for aesthetics and debugging. Unfortunately due to a fixed time frame, this idea was scraped before it could be fully implemented. However, the decoder worked perfectly!

Usage

In order to make it accessible for as many people in as many different languages as possible, I converted our code from python to JSON. Just find a JSON library for your desired language, and it'll work perfectly!

The source of the library is on GitHub as a gist. I recommend downloading the file to use yourself, however for testing you can use GitHub's raw file as a hotlink.

morse_code_decoder.json    View Raw
 1{
 2  " ":" ",
 3  "'":".----.",
 4  "(":"-.--.-",
 5  ")":"-.--.-",
 6  ",":"--..--",
 7  "-":"-....-",
 8  ".":".-.-.-",
 9  "/":"-..-.",
10  "0":"-----",
11  "1":".----",
12  "2":"..---",
13  "3":"...--",
14  "4":"....-",
15  "5":".....",
16  "6":"-....",
17  "7":"--...",
18  "8":"---..",
19  "9":"----.",
20  ":":"---...",
21  ";":"-.-.-.",
22  "?":"..--..",
23  "A":".-",
24  "B":"-...",
25  "C":"-.-.",
26  "D":"-..",
27  "E":".",
28  "F":"..-.",
29  "G":"--.",
30  "H":"....",
31  "I":"..",
32  "J":".---",
33  "K":"-.-",
34  "L":".-..",
35  "M":"--",
36  "N":"-.",
37  "O":"---",
38  "P":".--.",
39  "Q":"--.-",
40  "R":".-.",
41  "S":"...",
42  "T":"-",
43  "U":"..-",
44  "V":"...-",
45  "W":".--",
46  "X":"-..-",
47  "Y":"-.--",
48  "Z":"--..",
49  "_":"..--.-"
50}
Share this page