You are trying to set a json
object as a value to itself. Hence, it calls itself which becomes an invalid recursive call and hence the StackOverflowError
.
It's presumably a typo from your end, hence:
Change:
json.put("user_post_records", json);
To:
json.put("user_post_records", j);