Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6975

Provide an option to deactivate escaping in JSON serialization

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5
    • Fix Version/s: 2.5.0-alpha-1
    • Component/s: JSON
    • Flags:
      Patch

      Description

      This is a following of GROOVY-6937 and GROOVY-6852.

      The bug is fixed, but still, we miss a configuration flag in JsonSlurper or somewhere else, or another way to deactivate escaping to have a better serialization output in term of size.

      See the sample attached. Comparing to the JSR 353 Reference Implementation, Groovy output is huge (> 4.8x). In an application requiring utf-8 encoding with a lot of traffic, this is clearly not acceptable.

      As said in GROOVY-6937 and GROOVY-6852, this can be fixed by removing the condition line 370:
      c > 126
      in:
      } else if (c < ' ' || c > 126) {

        Attachments

        1. Draft.groovy
          1 kB
          Mathieu Carbou

          Activity

            People

            • Assignee:
              jwagenleitner John Wagenleitner
              Reporter:
              kha Mathieu Carbou
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: