[ https://issues.apache.org/jira/browse/SLING-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Carsten Ziegeler updated SLING-4288: ------------------------------------ Summary: JSON object returns null when JSON object is having a value of type map and the map is having a list as one of its element (was: JSON object provided by org.apache.sling.commons.json 2.0.8 version returns null when JSON object is having a value of type map and the map is having a list as one of its element) > JSON object returns null when JSON object is having a value of type map and > the map is having a list as one of its element > -------------------------------------------------------------------------------------------------------------------------- > > Key: SLING-4288 > URL: https://issues.apache.org/jira/browse/SLING-4288 > Project: Sling > Issue Type: Bug > Components: Commons > Affects Versions: Commons JSON 2.0.8 > Reporter: Pulkit Agarwal > Assignee: Carsten Ziegeler > Labels: JSON > Fix For: Commons JSON 2.0.10 > > > I am having a test case where I have to place a map in a JSONObject. Below is > the sample code for the same. > @Test > public void testSample() throws JSONException > { > HashMap<String,Object> map=new HashMap<String,Object>(); > map.put("abc", "123456"); > map.put("id", null); > List<String> list=new ArrayList<String>(); > list.add("Admin"); > list.add("password"); > map.put("groups", list); > JSONObject response=new JSONObject(); > response.put("key", map); > System.out.println(response.get("key")); > } > Now when I execute the code keeping org.apache.sling.commons.json version > 2.0.8 in the classpath then response.get("key")returns null where as in case > of bundle version 2.0.6 its returns map. > Please note this issue is reproducible when the map is an element of type > list. -- This message was sent by Atlassian JIRA (v6.3.4#6332)