Added connection to DB and convert to JSON