Uploaded image for project: 'ProtoStream'
  1. ProtoStream
  2. IPROTO-34

Protobuf/Json mapping generates invalid json

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.2.0.Alpha3, 4.2.0.Final
    • 4.0.0.Alpha5
    • None

      A json containing a string field value with the '\n', when converted to protobuf and back results in invalid json with line breaks.

      The following escaping should be done:

      '"'  => "\\\"";
      '\\' => "\\\\";
      '\t' => "\\t";
      '\b' => "\\b";
      '\n' => "\\n";
      '\r' => "\\r";
      '\f' => "\\f";
      

      Source: RFC 7159:

      All Unicode characters may be placed within the
      quotation marks, except for the characters that must be escaped:
      quotation mark, reverse solidus, and the control characters (U+0000
      through U+001F).

              gfernand@redhat.com Gustavo Fernandes (Inactive)
              gfernand@redhat.com Gustavo Fernandes (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: