recursion fixed but json not perfect