JSON encoding for protobuf