Reduce memory allocation when outputting to yaml/json.
ofpx encode should report line number of errors correctly.