I am getting the value of map<string,map<map<string,string>,string>> for controller. I need to iterate and display the value in vf page, But I am not getting the output.

<apex:page showHeader="true" controller="DealerReport">
                <apex:repeat value="{!map}" var="fieldKey">
                    key: {!fieldKey }
                    value: {!map[fieldKey]}
                    <apex:variable var="c" value="{!map[fieldKey]}" />

smaple map: map<productType,map<map<name,size>,quantity>>


  • Can you post sample value of your map map<string,map<map<string,string>,string>>
    – Reshma
    Commented Mar 11, 2019 at 9:06
  • {Flowers={{rose=20cm}=10pcs}} Commented Mar 11, 2019 at 9:13

2 Answers 2


You won't be able to display that kind of a Map as in one of your inner Map you are having a complex type i.e. Map (i.e. in 2nd Map where you have Map of string,string) as key which cannot be sorted and hence, you won't be able to display in visualforce page using a straight forward approach.

Looking at the example you have provided, you can use Map<string,Map<string, Map<string,string>>> instead of Map<string,Map<Map<string,string>,string>>. So as per your example, you can have your data like {Flowers={rose= {20cm=10pcs}}} instead of {Flowers={{rose=20cm}=10pcs}}.

Having the data in the above format will make your visualforce page much simpler and you can show the data using this below code

Note : You will have to change the datatype to Map<string,Map<string, Map<string,string>>> and have the data in this format {Flowers={rose= {20cm=10pcs}}}, only then you would be able to use this below visualforce code.

<apex:repeat value="{!map}" var="fieldKey1">
    key1: {!fieldKey1}
    value1: {!map[fieldKey1]}
    <apex:repeat value="{!map[fieldKey1]}" var="fieldKey2">
        key1: {!fieldKey2}
        value1: {!map[fieldKey1][fieldKey2]}
        <apex:repeat value="{!map[fieldKey1][fieldKey2]}" var="fieldKey3">
            key1: {!fieldKey3}
            value1: {!map[fieldKey1][fieldKey2][fieldKey3]}

The declaration format you are using map<string,map<map<string,string>,string>> is not right. using map as a key in the map is not the right approach because keys can not be sorted. you should use map in below format and arrange your data accordingly.


Please mark this answer selected if it helped.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .