to_json function added