# How to return list of "name" from knowledge base (json file) by order of ID

**URL:** <https://forum.rasa.com/t/how-to-return-list-of-name-from-knowledge-base-json-file-by-order-of-id/26256>\
**Category:** \[Deprecated\] Rasa X Community Edition\
**Created:** [March 18, 2020, 8:48am UTC](https://forum.rasa.com/t/how-to-return-list-of-name-from-knowledge-base-json-file-by-order-of-id/26256 "2020-03-18T08:48:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nhha1602](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nhha1602/32/11941_2.png) [@nhha1602](https://forum.rasa.com/u/nhha1602)\
**Post date:** [March 18, 2020, 8:48am UTC](https://forum.rasa.com/t/how-to-return-list-of-name-from-knowledge-base-json-file-by-order-of-id/26256/1 "2020-03-18T08:48:37Z")

</div>

Dear All,

I used a json file for knowledge base as following instruction link:

> **[rasa/examples/knowledgebasebot at main · RasaHQ/rasa](https://github.com/RasaHQ/rasa/tree/main/examples/knowledgebasebot)**
>
> main/examples/knowledgebasebot

I want to list name of obj types same as the order of ID of obj types.

As below examples, I want to list all the name as following order: (same as the order of ID)

1 - Donath

2 - Berlin Burrito Company

3 - I due forni

“restaurant”: [

```
    {
        "id": 0,
        "name": "Donath",
        "cuisine": "Italian",
        "outside-seating": true,
        "price-range": "mid-range"
    },
    {
        "id": 1,
        "name": "Berlin Burrito Company",
        "cuisine": "Mexican",
        "outside-seating": false,
        "price-range": "cheap"
    },
    {
        "id": 2,
        "name": "I due forni",
        "cuisine": "Italian",
        "outside-seating": true,
        "price-range": "mid-range"
    }
],

```

Please advise this …

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [March 18, 2020, 8:52pm UTC](https://forum.rasa.com/t/how-to-return-list-of-name-from-knowledge-base-json-file-by-order-of-id/26256/2 "2020-03-18T20:52:52Z")

</div>

Hi Hai Ha,

You would call the `set_representation_function_of_object()` to overwrite the default representation of the object type `restaurant`. You’ll see an example of this in the `actions.py` and discussed in the [Customizing the InMemoryKnowledgeBase](https://rasa.com/docs/rasa/core/knowledge-bases/#customizing-the-inmemoryknowledgebase) section.

Here’s an example for `restaurant` that adds `cuisine` to the response:

```auto
knowledge_base.set_representation_function_of_object(
    "restaurant", lambda obj: obj["name"] + " (" + obj["cuisine"] + ")"
)

```

---

<div class="post-metadata">

**Author:** ![nhha1602](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nhha1602/32/11941_2.png) [@nhha1602](https://forum.rasa.com/u/nhha1602)\
**Post date:** [March 20, 2020, 6:29am UTC](https://forum.rasa.com/t/how-to-return-list-of-name-from-knowledge-base-json-file-by-order-of-id/26256/3 "2020-03-20T06:29:55Z")

</div>

OK, Thank you
