Corrected faulty code in returned json encoded tupple