import json


def toJson(val):
	"""Return JSON string

	Supported datatypes:
		<class 'sqlalchemy.engine.result.RowProxy'>
		<type 'dict'>

	Args:
		val: datatype that gets converted to JSON string
	"""
	if str(type(val)) == "<class 'sqlalchemy.engine.result.RowProxy'>":
		return json.dumps(dict(val.items()))
	return json.dumps(val)