JSON.decode implementation

This is just to keep track of the development for this branch. It's not ready to merge yet :)