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

JsonOutput should handle Records like POGOs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.14, 3.0.19
    • 5.0.0-alpha-2, 4.0.15
    • JSON
    • None

    Description

      The following assertion fails:

      import groovy.json.JsonOutput
      record Person(String name) {}
      assert JsonOutput.toJson([new Person('Guillaume')]) == '[{"name":"Guillaume"}]'

      All records are serialised as {}

      I would expect records to be serialised as normal POGOs or Maps, etc.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              glaforge Guillaume Laforge
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: