@Override public void serialize(OFFlowModMap fmm, JsonGenerator jGen, SerializerProvider serializer) throws IOException, JsonProcessingException { jGen.configure(Feature.WRITE_NUMBERS_AS_STRINGS, true); // IMHO this just looks nicer and is easier to read if everything is quoted if (fmm == null) { jGen.writeStartObject(); jGen.writeString("No flows have been added to the Static Flow Pusher."); jGen.writeEndObject(); return; } Map<String, Map<String, OFFlowMod>> theMap = fmm.getMap(); jGen.writeStartObject(); if (theMap.keySet() != null) { for (String dpid : theMap.keySet()) { if (theMap.get(dpid) != null) { jGen.writeArrayFieldStart(dpid); for (String name : theMap.get(dpid).keySet()) { jGen.writeStartObject(); jGen.writeFieldName(name); OFFlowModSerializer.serializeFlowMod(jGen, theMap.get(dpid).get(name)); jGen.writeEndObject(); } jGen.writeEndArray(); } } } jGen.writeEndObject(); }