Support deserialization of Json values in GraphQL queries
authorLaurent Wouters <lwouters@cenotelie.fr>
Fri, 14 Dec 2018 15:54:57 +0100
changeset 9 fa1f617f137e
parent 8 66fe6779aa70
child 10 b3037af67eab
Support deserialization of Json values in GraphQL queries
cubicweb_graphql/gql_schema.py
--- a/cubicweb_graphql/gql_schema.py	Fri Dec 14 14:46:50 2018 +0100
+++ b/cubicweb_graphql/gql_schema.py	Fri Dec 14 15:54:57 2018 +0100
@@ -126,7 +126,9 @@
 
     @staticmethod
     def serialize(value):
-        return json.loads(value)
+        if isinstance(value, str) or isinstance(value, unicode):
+            return json.loads(value)
+        return value
 
     @staticmethod
     def parse_literal(node):