Back to project page dandy.
The source code is released under:
GNU General Public License
If you think the Android project dandy listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.workhabit.drupal.api.json; /*from w w w.j av a 2 s .c o m*/ import com.google.gson.*; import java.lang.reflect.Type; /** * Copyright 2009 - WorkHabit, Inc. - acs * Date: Oct 24, 2010, 4:56:31 PM */ public class BooleanAdapter implements JsonSerializer<Boolean>, JsonDeserializer<Boolean> { public JsonElement serialize(Boolean src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src ? 1 : 0); } public Boolean deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return json.getAsInt() == 1; } }