format the tables information into json and write back to client