created make_json and encode photo functions