diff --git a/RJson.cabal b/RJson.cabal
--- a/RJson.cabal
+++ b/RJson.cabal
@@ -1,5 +1,5 @@
 Name:          RJson
-Version:       0.1
+Version:       0.2
 Cabal-Version: >= 1.2
 License:       BSD3
 License-File:  LICENSE
diff --git a/Text/RJson.hs b/Text/RJson.hs
--- a/Text/RJson.hs
+++ b/Text/RJson.hs
@@ -1,3 +1,5 @@
+{-# OPTIONS_GHC -XFlexibleInstances -XOverlappingInstances -XMultiParamTypeClasses -XFlexibleContexts -XUndecidableInstances -XTemplateHaskell #-}
+
 module Text.RJson (TranslateField,
                    TranslateFieldD,
                    translateField,
@@ -265,11 +267,8 @@
 genericToJson x
         | isAlgType (dataTypeOf toJsonProxy x) =
             case (map (translateFieldD' dict x) (filter (not . (excludeD dict x)) (getFields x))) of
-              [] -> JDArray $
-                      arrayPrependD dict x ++
-                      (JDString (dataTypeName (dataTypeOf toJsonProxy x)) :
-                       (gmapQ toJsonProxy (toJsonD dict) x)) ++
-                      arrayAppendD dict x
+              [] -> case gmapQ toJsonProxy (toJsonD dict) x of
+                      l  -> JDArray $ (arrayPrependD dict x) ++ l ++ (arrayAppendD dict x)
               fs -> JDObject (M.fromList (objectExtrasD dict x ++ (zip fs (gmapQ toJsonProxy (toJsonD dict) x))))
         | True =
             error ("Unable to serialize the primitive type '" ++ typename x ++ "'")
@@ -533,8 +532,7 @@
               Left e  -> throwError e
               Right x -> return x))
 
-genericFromJson :: Data FromJsonD a => a -> JsonData -> Either String a
-genericFromJson _     (JDArray []) = Left "Bad fromJson conversion: JSON array must contain at least one element"
+genericFromJson :: (Data FromJsonD a, Data TranslateFieldD a) => a -> JsonData -> Either String a
 genericFromJson dummy (JDArray l) =
     case datarep (dataTypeOf fromJsonProxy dummy) of
       AlgRep (c:_) ->
@@ -549,8 +547,9 @@
             fs -> evalState (runErrorT (gmapM fromJsonProxy (m2 (objectDefaultsD dict dummy)) (fromConstr fromJsonProxy c))) (m, fs)
       AlgRep _     -> Left "Bad fromJson conversion: Type with no constructors!"
       _            -> Left "Bad fromJson conversion: Non-algebraic datatype given to 'genericFromJson'"
+genericFromJson _ _ = Left "Bad fromJson conversion: Expecting JSON object or array"
           
-instance (Data FromJsonD t) => FromJson t where
+instance (Data FromJsonD t, Data TranslateFieldD t) => FromJson t where
     fromJson = genericFromJson
 
 
@@ -748,3 +747,11 @@
 -- | Converts a value to an ASCII-only JSON String.
 toJsonString :: ToJson a => a -> String
 toJsonString = show . toJson
+
+data Test = Foo | Bar deriving Show
+$(derive[''Test])
+data Test2 = Test2 Int Int deriving Show
+$(derive[''Test2])
+
+trans :: (Data FromJsonD a) => a -> Int
+trans _ = 7
