hierarchy from db to json - then wrap into jar and use through API