# How to return JSONObject from Activity to Workflow

**URL:** <https://community.temporal.io/t/how-to-return-jsonobject-from-activity-to-workflow/1227>\
**Category:** Community Support\
**Created:** [December 23, 2020, 8:59pm UTC](https://community.temporal.io/t/how-to-return-jsonobject-from-activity-to-workflow/1227 "2020-12-23T20:59:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gordon\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_sun/32/82_2.png) [@Gordon\_Sun](https://community.temporal.io/u/Gordon_Sun)\
**Post date:** [December 23, 2020, 8:59pm UTC](https://community.temporal.io/t/how-to-return-jsonobject-from-activity-to-workflow/1227/1 "2020-12-23T20:59:36Z")

</div>

I’m getting this exception

`Caused by: io.temporal.common.converter.DataConverterException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "empty" (class org.json.JSONObject), not marked as ignorable (one known property: "map"])`

I tried to use [https://github.com/FasterXML/jackson-datatypes-misc](https://github.com/FasterXML/jackson-datatypes-misc) but did not work. Is it because the sdk is using a mapper that I cannot modify to support JSONObject?

---

<div class="post-metadata">

**Author:** ![Gordon\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_sun/32/82_2.png) [@Gordon\_Sun](https://community.temporal.io/u/Gordon_Sun)\
**Post date:** [December 23, 2020, 9:22pm UTC](https://community.temporal.io/t/how-to-return-jsonobject-from-activity-to-workflow/1227/2 "2020-12-23T21:22:57Z")

</div>

I switched to use JsonNode from fasterxml.jackson  
I suggest change have Temporal’s jackson mapper support org.json. It’s probably a one line change. I feel over time org.json will be very popular  
But of course once Temporal support Typescript I’m out of Java

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [December 23, 2020, 11:41pm UTC](https://community.temporal.io/t/how-to-return-jsonobject-from-activity-to-workflow/1227/3 "2020-12-23T23:41:35Z")

</div>

I’m confused. Are you trying to return JSONObject instead of its serialized form from an activity? Have you considered returning byte array that contains the serialized JSON?

---

<div class="post-metadata">

**Author:** ![Gordon\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_sun/32/82_2.png) [@Gordon\_Sun](https://community.temporal.io/u/Gordon_Sun)\
**Post date:** [December 23, 2020, 11:55pm UTC](https://community.temporal.io/t/how-to-return-jsonobject-from-activity-to-workflow/1227/4 "2020-12-23T23:55:51Z")

</div>

Yes. I was returning JSONObject directly from Activity. Jackson automatically tries to serialize it but failed. I then switched to return JsonNode instead

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [December 24, 2020, 12:41am UTC](https://community.temporal.io/t/how-to-return-jsonobject-from-activity-to-workflow/1227/5 "2020-12-24T00:41:28Z")

</div>

I see. I don’t think we can change the default from Jackson, as it can be a breaking change. The good news that DataConverter is fully pluggable and you can choose whatever serializer you prefer.

---

<div class="post-metadata">

**Author:** ![Gordon\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_sun/32/82_2.png) [@Gordon\_Sun](https://community.temporal.io/u/Gordon_Sun)\
**Post date:** [December 24, 2020, 1:05am UTC](https://community.temporal.io/t/how-to-return-jsonobject-from-activity-to-workflow/1227/6 "2020-12-24T01:05:45Z")

</div>

Could you provide more info on DataConverter  
I found only 2 mentions in the doc [https://docs.temporal.io/search?q=DataConverter](https://docs.temporal.io/search?q=DataConverter)

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [December 24, 2020, 1:49am UTC](https://community.temporal.io/t/how-to-return-jsonobject-from-activity-to-workflow/1227/7 "2020-12-24T01:49:36Z")

</div>

We are planning to fully rewrite the SDKs documentation. DataConverter will be also covered.
