Added sql conversion to JSON