In Your JSON
Brainfuck dressed up as a configuration file, one command per key.
Blair Myhre, 2023 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Blair Myhre made In Your JSON in 2023. A program is a JSON file, and every brainfuck command is the value of its own key. The keys must be unique and named Action1, Action2 and on. A translator joins the values in that order and hands the result to a brainfuck interpreter. The specification gives the translator twice, in JavaScript and in Python, each a few lines.
The machine
| Part | Is |
|---|---|
{ ... } | The program, one JSON object |
"Action1": "," | The first command, here , |
"ActionN" | The Nth command; N runs from 1 to the number of keys |
| values | + - < > . , [ ], as in brainfuck |
The translator counts the keys and then asks for each ActionN by number, so the order of the keys in the file does not matter. A key with any other name leaves a number missing, and that is an error.
Underneath it is brainfuck with byte cells that wrap, and , reads 0 at the end of the input.
Example
The program is ,[.,], a cat.
The program is ,[.,], a cat.
The same five keys in another order still make ,[.,].
Patterns it teaches
- Camouflage: the program passes for a data file.
Further
- esolangs.org/wiki/In_Your_JSON
- Brainfuck, the language underneath.
See also
In Your JSON builds on Brainfuck.
Brainfuck equivalents
Write your own in Run Convert a program from In Your JSON
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: in-your-json.
Command line
shib run in-your-json -e '{
"Action1": ",",
"Action2": "[",
"Action3": ".",
"Action4": ",",
"Action5": "]"
}' --input 'In Your JSON '