result to json and new table problems