@Override
 @SuppressWarnings("unused")
 protected JSONObject doDeserialize(
     FlowPropertyProvider flowPropertyProvider,
     FlowPropertyDefinition flowPropertyDefinition,
     DataClassDefinition dataClassDefinition,
     Object serializedObject)
     throws FlowValidationException {
   return JSONObject.toJsonObject(serializedObject);
 }
  @Test
  public void testTofromJson() {
    Map<String, Object> inMap = new LinkedHashMap<String, Object>();
    MapJsonRenderer<String, Object> renderer = new MapJsonRenderer<String, Object>(false);
    Map<String, Object> outMap = TestJsonRendererUtil.toFromJson(renderer, inMap);
    assertEquals(outMap, inMap);

    inMap.put("foo", true);
    // check recursion
    inMap.put("bar", new LinkedHashMap<Object, Object>());
    inMap.put("str", "\'\":);");
    outMap = TestJsonRendererUtil.toFromJson(renderer, inMap);
    assertEquals(outMap.size(), inMap.size());
    assertEquals(outMap.get("foo"), inMap.get("foo"));
    assertEquals(outMap.get("str"), inMap.get("str"));

    // we can't know that the nested map should be interpreted as a map.
    JSONObject actual = (JSONObject) outMap.get("bar");
    assertEquals(actual.asMap(), inMap.get("bar"));
  }
 @Test
 public void testFromJsonBasic() {
   MapJsonRenderer<String, String> renderer = new MapJsonRenderer<String, String>(false);
   String input = "{\"foo\":true,\"bar\":{},\"str\":\"'\\\":);\"}";
   Map<String, String> map = renderer.fromJson(Map.class, JSONObject.toJsonObject(input));
   assertEquals(map.entrySet().size(), 3);
   assertEquals(map.get("foo"), Boolean.TRUE);
   assertEquals(map.get("str"), "\'\":);");
   Object obj = map.get("bar");
   Map<String, String> mapElement = renderer.fromJson(Map.class, obj);
   assertEquals(mapElement.entrySet().size(), 0);
 }
 @Override
 @SuppressWarnings("unused")
 protected IJsonWriter doSerialize(
     FlowPropertyDefinition flowPropertyDefinition,
     DataClassDefinition dataClassDefinition,
     IJsonWriter jsonWriter,
     JSONObject object) {
   // empty json are appended as null but here we want to preserve them, so write them as {}
   if (object != null && object.equals(null)) {
     jsonWriter.object();
     jsonWriter.endObject();
     return jsonWriter;
   }
   return jsonWriter.value(object);
 }