groovy
  1. groovy
  2. GROOVY-5169

JsonOutput.toJson(object) is not returning expected results

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.8.4
    • Fix Version/s: None
    • Component/s: JSON
    • Labels:
    • Number of attachments :
      6

      Description

      Consider the attached Groovy script. It defines two classes. Each has public properties explicitly defined. When I send the resulting objects to JsonOutput.toJson(), I expect the public properties of the object to be serialized into the JSON output. This is not working as expected. The only properties that get serialized are those created via "def propName" and those that seem to have getter methods (this in not actually the case).

      Attached is a screenshot of GroovyConsole running the attached script.

      1. 0001-bugfix.patch
        2 kB
        umang bhatt
      2. json_test.groovy
        0.8 kB
        James Sumners
      3. MetaClassImpl.java
        151 kB
        umang bhatt
      4. MetaClassImpl.patch
        2 kB
        blackdrag blackdrag
      1. GroovyConsole_output.png
        275 kB
      2. screenshot.png
        67 kB

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            James Sumners
          • Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated: