Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-176

List of single item is turned into just a single item.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • 2.0.RC1
    • Beta 9
    • None

    Description

      have a method which returns an object containing a list. if the list is only one element long the JSON drops the '[' ']' which confuses our client software.

      @GET
      @Path("list")
      @Produces("application/json")
      public Three findThreeList()

      { One one = new One(); one.setFirst("previous"); List<One> ones = new ArrayList<One>(1); ones.add(one); Three three = new Three(); three.setOnes(ones); log.info(three); return three; }

      generated output without brackets:
      {"three":{"ones":

      {"first":"previous"}

      }}

      if multi items in list it's correct:
      {"three":{"ones":[

      {"first":"previous"}

      ,

      {"first":"next"}

      ]}}

      Attachments

        Activity

          People

            patriot1burke@gmail.com Bill Burke (Inactive)
            flesner_jira Daniel Flesner (Inactive)
            Votes:
            5 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: