Search code examples
javaaemjcr

how can I access the string array stored in jcr node?


In my jcr node I have the key subpage and it holds the value of type String[]:

{"title":"some title1", "url":"some url1"}
{"title":"some title2", "url":"some url2"}
{"title":"some title3", "url":"some url3"}
{"title":"some title4", "url":"some url4"}

how can I access it in java?

I tried:

ValueMap contentValueMap = resource.getValueMap();

String subpages = contentValueMap.get("subpage", String.class);

System.out.println(subpages); 

but it only prints the first string:

{"title":"some title1", "url":"some url1"}

how can I reach the rest of them?


Solution

  • this should work-

    String[] subpages = contentValueMap.get("subpage", String[].class);