cleans up JSON building