/**
 * 
 */
package net.floodlightcontroller.mobilesdn.web;

import java.io.IOException;

import net.floodlightcontroller.mobilesdn.APAgent;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
 * @author Yanhe Liu <yanhe.liu@cs.helsinki.fi>
 *
 */
public class AgentJsonSerializer extends JsonSerializer<APAgent> {

    /**
     * Handles serialization for APAgent
     */
    @Override
    public void serialize(APAgent agent, JsonGenerator jGen,
            SerializerProvider serializer) throws IOException,
            JsonProcessingException {
        
        jGen.writeStartObject();
        
        jGen.writeArrayFieldStart("ssid");
        jGen.writeString(agent.getSSID());
        jGen.writeEndArray();

        jGen.writeArrayFieldStart("bssid");
        jGen.writeString(agent.getBSSID());
        jGen.writeEndArray();
        
        jGen.writeEndObject();
    }
    
    
    /**
     * Tells SimpleModule that we are the serializer for APAgent
     */
    @Override
    public Class<APAgent> handledType() {
        return APAgent.class;
    }

}

@@ -133,16 +133,66 @@
 APAgent;
+%0Aimport net.floodlightcontroller.mobilesdn.Client;
 %0A%0Aimport
@@ -839,30 +839,43 @@
 rite
-ArrayFieldStart(%22ssid%22
+StringField(%22ssid%22, agent.getSSID()
 );%0A 
@@ -889,33 +889,47 @@
 jGen.writeString
-(
+Field(%22bssid%22, 
 agent.getSSID())
@@ -913,32 +913,33 @@
 ssid%22, agent.get
+B
 SSID());%0A       
@@ -939,38 +939,16 @@
         
-jGen.writeEndArray();%0A
 %0A       
@@ -975,21 +975,22 @@
 dStart(%22
-bssid
+client
 %22);%0A    
@@ -985,32 +985,107 @@
 ient%22);%0A        
+int count = 0;%0A        for (Client clt : agent.getAllClients()) %7B%0A        %09
 jGen.writeString
@@ -1089,54 +1089,156 @@
 ing(
-agen
+cl
 t.get
-BSSID());%0A        jGen.writeEndArray(
+MacAddress().toString());%0A        %09count++;%0A        %7D%0A        jGen.writeEndArray();%0A        %0A        jGen.writeNumberField(%22clientnum%22, count
 );%0A 

Modify rest-api for agent