### Question:
JSONConverter implements Converter { public <T> T convertFrom(String inJSONString) throws ConversionException { if (inJSONString == null) { return null; } try { return (T) VioletPojoFixer.fixPojo(JSONValue.parse(inJSONString)); } catch (final JSONException e) { throw new ConversionException("JSON conversion failed for input string : " + inJSONString); } } JSONConverter(); String getFormatName(); T convertFrom(String inJSONString); T convertFrom(Reader inJSONReader); String convertTo(Object value); String convertTo(Object inPojo, boolean silentMode); static final String JSON_FORMAT; }### Answer:
@Test public void testconvertFromJSON() { System.out.println("JSON Test string :\n" + JSONConverterTest.strJSONTest); final Date testDate = CCalendar.parseISODate("2002-02-02T22:22:22 UTC").getTime(); final Map<String, Object> map; try { map = ConverterFactory.JSON.convertFrom(JSONConverterTest.strJSONTest); } catch (final Exception e) { e.printStackTrace(); Assert.fail("Parse Exception !"); return; } Object value; Assert.assertTrue(map.containsKey("date")); value = map.get("date"); Assert.assertEquals(testDate, value); Assert.assertTrue(map.containsKey("actors")); final List actors = (List) map.get("actors"); Assert.assertEquals(3, actors.size()); Assert.assertEquals("laurel", actors.get(0)); Assert.assertEquals(new Integer(1), map.get("version")); final String strDecodedBinaryData = new String((byte[]) map.get("bdata")); System.out.println("Decoded base64 chars :" + strDecodedBinaryData); Assert.assertEquals(new String(JSONConverterTest.binaryTestData), strDecodedBinaryData); }