pythonencodebytecode-manipulationvm-implementation

Encoding a .json file for a bytecode vm


I'm trying to make a Bytecode VM in python just for fun, as a hobby project, but i have a problem, how i can encode a json file like this:

{
 "code": [["0xf2", "Hello"], ["0xf3", 1]],
 "constants": []
}

into some file format, something like encrypting, but in some way that it doesn't get so random, i need something more readable but encrypted at the same time.


Solution

  • Encoded files and human-readable files are not always compatible. However, I believe that BSON, an encoded JSON variant, is a good solution to your problem.