reworking json strucutre and pluging into dynamic data from database