encapsulate data correctly in json