ObjectToJsonConverter { public Object convertToJson(Object pValue, List<String> pPathParts, JsonConvertOptions pOptions) throws AttributeNotFoundException { Stack<String> extraStack = pPathParts != null ? EscapeUtil.reversePath(pPathParts) : new Stack<String>(); return extractObjectWithContext(pValue, extraStack, pOptions, true); } ObjectToJsonConverter(StringToObjectConverter pStringToObjectConverter,
                                 Extractor... pSimplifyHandlers); Object convertToJson(Object pValue, List<String> pPathParts, JsonConvertOptions pOptions); Object setInnerValue(Object pOuterObject, Object pNewValue, List<String> pPathParts); Object extractObject(Object pValue, Stack<String> pPathParts, boolean pJsonify); ValueFaultHandler getValueFaultHandler();  }
@Test public void convertToJsonTest() throws MalformedObjectNameException, AttributeNotFoundException { File file = new File("myFile"); Map ret = (Map) converter.convertToJson(file, null, JsonConvertOptions.DEFAULT); assertEquals(ret.get("name"),"myFile"); String name = (String) converter.convertToJson(file, Arrays.asList("name"), JsonConvertOptions.DEFAULT); assertEquals(name,"myFile"); }
@Test public void convertTransientValue() throws AttributeNotFoundException { TransientValueBean bean = new TransientValueBean(); bean.value = "value"; bean.transientValue = "transient"; Map ret = (Map)converter.convertToJson(bean, null, JsonConvertOptions.DEFAULT); assertNull(ret.get("transientValue")); assertEquals(ret.get("value"),"value"); }