# Query response to JSON format for Python v4

**URL:** <https://forum.weaviate.io/t/query-response-to-json-format-for-python-v4/2450>\
**Category:** Support\
**Tags:** python\
**Created:** [May 24, 2024, 2:37am UTC](https://forum.weaviate.io/t/query-response-to-json-format-for-python-v4/2450 "2024-05-24T02:37:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![darshit-s3](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@darshit-s3](https://forum.weaviate.io/u/darshit-s3)\
**Post date:** [May 24, 2024, 2:37am UTC](https://forum.weaviate.io/t/query-response-to-json-format-for-python-v4/2450/1 "2024-05-24T02:37:45Z")

</div>

Hi,  
Is there a way to convert QuerySearchReturnType object directly to json out of the box?

For query.near\_text in python v3 we could directly do  
print(json.dumps(response))  
but for python v4, the returned object is not serializable

TypeError: Object of type QueryReturn is not JSON serializable

Example coode:

```auto
questions = client.collections.get("Question")
response = questions.query.near_text(
            query="biology",
            limit=2,
            return_properties=["category", "question", "answer"],
            return_metadata=MetadataQuery(distance=True)
        )
json.dumps(response) # this would fail

```

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [May 28, 2024, 12:06pm UTC](https://forum.weaviate.io/t/query-response-to-json-format-for-python-v4/2450/2 "2024-05-28T12:06:26Z")

</div>

hi @darshit-s3 !!

Welcome to our community! 🤗

This is a nice feature request.

A way of doing that, as of now, would be by introspecting each object and generating the json, or hard coding it from outside the client.

Please, feel free (and invited) to open an issue here:

> **[GitHub - weaviate/weaviate-python-client: A python native client for easy...](https://github.com/weaviate/weaviate-python-client/)**
>
> A python native client for easy interaction with a Weaviate instance. - weaviate/weaviate-python-client

So we can bring this to our developers.

Thanks!

---

<div class="post-metadata">

**Author:** ![Dirk](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dirk/32/46_2.png) [@Dirk](https://forum.weaviate.io/u/Dirk)\
**Post date:** [May 29, 2024, 4:18am UTC](https://forum.weaviate.io/t/query-response-to-json-format-for-python-v4/2450/3 "2024-05-29T04:18:26Z")

</div>

we already have an issue for this [Allow JSON-esque outputs through `str/repr` · Issue #881 · weaviate/weaviate-python-client · GitHub](https://github.com/weaviate/weaviate-python-client/issues/881) - but it is currently not planned
