Doing the JSON stringifying only when it is needed