public JSONObject switchToJSON ( Switch s ) { JSONObject o = new JSONObject ( ) ; o . put ( "id" , s . id ( ) ) ; o . put ( CAPACITY_LABEL , s . getCapacity ( ) ) ; return o ; }
Convert a Switch to a JSON object .