Json to db and db to log