It seems much simpler to split `as_json` into two functions, one which returns a string with JSON, and another which returns a json-serializable structure; rather than putting a new flag on this.