Chapter 14: Accessing Arrays

To access a profile property with multiple elements, you normally use standard M2Doc, such as:

{ m:myObject.user_list_of_elements.name }

However, if the profile property contains a JavaScript array instead of a Java List, you get an error message complaining about an [Ljava.lang.Object;.


Note:  You can check the presence of a JavaScript array by completing the following steps.

  1. Start medini analyze in debug mode.

  2. Select the profile property, then select Diagnose > What is this?

  3. The value in the Attributes view is shown as [Ljava.lang.Object;.


If you know that your profile property contains a JavaScript array of multiple elements, you can use the asList() service to access the elements.

In the following example, the elements of the profile property user_foo are returned as a comma-separated list.

Example

{ m:pkg.user_foo.asList()->sep(', ') }