Difference in Template Rendering Between Velocity 2.3 and 2.4.1 for Map with List

Mergu Ravi <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.devel
Message-ID <CAK+i-4KgWuB336AkOz6sk5rWpjHEDn7uiVYnARBuauDiqdgw8g@mail.gmail.com>
Dear Velocity Team,

I hope this message finds you well.

I'm currently using Apache Velocity in my Java application, and I noticed a
behavioral difference in template rendering when upgrading from version
*2.3* to *2.4.1*.
Template:

{
  "students" :  $student.values
}

Sample JSON (studentData):

{
  "student": {
    "values": [
      { "id": 1, "name": "Alice", "age": 20, "grade": "A" },
      { "id": 2, "name": "Bob", "age": 21, "grade": "B" }
    ]
  }
}

Output in Velocity 2.3:

{
  "students" : [{id=1, name=Alice, age=20, grade=A}, {id=2, name=Bob,
age=21, grade=B}]
}

Output in Velocity 2.4.1:

{
  "students" : [[{id=1, name=Alice, age=20, grade=A}, {id=2, name=Bob,
age=21, grade=B}]]
}

Concern:

In *2.4.1*, the result includes an extra set of brackets, indicating that
Velocity is now treating the .values object as a list containing a list
instead of a list itself.

This change in behavior breaks backward compatibility in my use case. I'm
unsure if this change was intentional or a regression.
Screenshots:

I’ve attached screenshots of the same Java code executed with both versions:

   -

   *velocity-2.3*
   - [image: Screenshot from 2025-07-22 18-38-28.png]

   -

   *velocity-2.4.1*
   - [image: Screenshot from 2025-07-22 18-39-00.png]


Request:

Could you please clarify if this is:

   -

   An intended change in how Velocity handles map values, or
   -

   A bug introduced in the recent release?

Additionally, if there's a recommended workaround or best practice for
handling this in 2.4.1, I’d greatly appreciate the guidance.

Thanks for maintaining such a helpful project!

Best regards,
*Ravi Mergu*
------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.