# Jsonata: return value from context array

**URL:** <https://discourse.nodered.org/t/jsonata-return-value-from-context-array/5469>\
**Category:** General\
**Created:** [4 December 2018 09:20 UTC](https://discourse.nodered.org/t/jsonata-return-value-from-context-array/5469 "2018-12-04T09:20:54Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [4 December 2018 09:42 UTC](https://discourse.nodered.org/t/jsonata-return-value-from-context-array/5469/2 "2018-12-04T09:42:15Z")

</div>

Hi @psmtvdw

you cannot use a JSONata expression as the key passed to the `flowContext` function.

You would have to get the full object from context and _then_ use a JSONata expression to pull out the piece you want:

```auto
$flowContext('Products').Products[ProductID=$$.topic].ProductName

```

This assumes the product ID you want to lookup is in `msg.topic` and that it is a number type - not a String. JSONata is strict about types.

For future reference, please read this post about sharing code/flows in the forum: [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

_[View the full topic](https://discourse.nodered.org/t/jsonata-return-value-from-context-array/5469)._
