Done recursive query for json return