graphql-python / graphene

GraphQL framework for Python

Home Page:http://graphene-python.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to desirelize from graphene object to json?

SomeAkk opened this issue · comments

Try to desirelize from graphene object to json, and do not know how to.

class From(graphene.ObjectType):
    node_id = graphene.String()
  pod = graphene.String()

mail = From(**json.loads(message))
... # some staf with mail object
json_mail = mail.dump() <- no such feature, how to it?

Want in json_mail see json or dict (which can be dumped to json with json.dump())

Graphene Types are currently not json-serializable without further. What do you need this feature for?

You know, it was so genius idea, that I'm ashamed to tell))
Main idea was to use graphene for data validation: just to not to use another library in project, but after research a found that there is no any variant to do that, so by that there is no any need to dump graphene objects to dict/json.

I thing problem solved.