Added proper JSON functionality

Theoretically should work