Basic Mysql to json converter in ruby