# How to extract data from json to yml of Rasa?

**URL:** <https://forum.rasa.com/t/how-to-extract-data-from-json-to-yml-of-rasa/61737>\
**Category:** Rasa Open Source\
**Created:** [April 22, 2024, 11:53am UTC](https://forum.rasa.com/t/how-to-extract-data-from-json-to-yml-of-rasa/61737 "2024-04-22T11:53:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaciejPelc](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/maciejpelc/32/24136_2.png) [@MaciejPelc](https://forum.rasa.com/u/MaciejPelc)\
**Post date:** [April 22, 2024, 11:53am UTC](https://forum.rasa.com/t/how-to-extract-data-from-json-to-yml-of-rasa/61737/1 "2024-04-22T11:53:46Z")

</div>

From tutorial I saw this:

```auto
- intent: order_food
  examples: |
    - I want to order a food
    - can I get some food, please
    - Let's order some food

- intent: inform_food
  examples: |
    - [steak](food)
    - [pasta](food)
    - [sushi](food)
    - [burger](food)

```

this is in my nlu.yml, can I extract those food examples from json? how to do that? should I write some kind of script that will extract my json and write those things in here?

---

<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:** [April 22, 2024, 3:52pm UTC](https://forum.rasa.com/t/how-to-extract-data-from-json-to-yml-of-rasa/61737/2 "2024-04-22T15:52:06Z")

</div>

You’re using an intent for entity extraction which is not a good idea. You should provide the entity examples within the context of intents like your `order_food` intent or collect the entity as part of a form.

Regarding converting from json, I would probably just write a convert tool to create the NLU examples in yaml from json. I’ve seen jinja2 used for this.

For something more involved, you could create a [custom importer](https://rasa.com/docs/rasa/training-data-importers/#writing-a-custom-importer).

---

<div class="post-metadata">

**Author:** ![MaciejPelc](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/maciejpelc/32/24136_2.png) [@MaciejPelc](https://forum.rasa.com/u/MaciejPelc)\
**Post date:** [April 23, 2024, 8:17am UTC](https://forum.rasa.com/t/how-to-extract-data-from-json-to-yml-of-rasa/61737/3 "2024-04-23T08:17:06Z")

</div>

> [@stephens](#):
>
> . You should provide the entity examples within the context of intents like your `order_food` intent or collect the entity as part of a form

can you show example how it is done properly?

---

<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:** [April 23, 2024, 2:45pm UTC](https://forum.rasa.com/t/how-to-extract-data-from-json-to-yml-of-rasa/61737/4 "2024-04-23T14:45:57Z")

</div>

```auto
- intent: order_food
  examples: |
    - I want to order a [steak](food)
    - can I get some [pasta](food), please
    - Let's order some [sushi](food)

```

---

<div class="post-metadata">

**Author:** ![MaciejPelc](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/maciejpelc/32/24136_2.png) [@MaciejPelc](https://forum.rasa.com/u/MaciejPelc)\
**Post date:** [April 23, 2024, 4:29pm UTC](https://forum.rasa.com/t/how-to-extract-data-from-json-to-yml-of-rasa/61737/5 "2024-04-23T16:29:16Z")

</div>

so I do not need this part:

```auto
- intent: inform_food
  examples: |
    - [steak](food)
    - [pasta](food)
    - [sushi](food)
    - [burger](food)

```

or maybe this, what you wrote is better to show rasa and at the same time, belowe provide intent with more examples of food?

---

<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:** [April 24, 2024, 3:28am UTC](https://forum.rasa.com/t/how-to-extract-data-from-json-to-yml-of-rasa/61737/6 "2024-04-24T03:28:03Z")

</div>

You should delete that. You should also go through the [training class](https://learning.rasa.com/conversational-ai-with-rasa/) to get a good overview of Rasa. Make sure you become familiar with forms.

---

<div class="post-metadata">

**Author:** ![MaciejPelc](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/maciejpelc/32/24136_2.png) [@MaciejPelc](https://forum.rasa.com/u/MaciejPelc)\
**Post date:** [April 26, 2024, 12:34pm UTC](https://forum.rasa.com/t/how-to-extract-data-from-json-to-yml-of-rasa/61737/7 "2024-04-26T12:34:30Z")

</div>

can you please tell me is this correct way?:

```auto
- intent: my_country
  examples: |
    - I am from [Poland](country_name)
    - I live in [Germany](country_name)

- : country_name
  examples: |
    - Poland
    - Germany
    - France
    - Italy
    - Spain
    - Portugal
    - Greece
    - Norway
    - Sweden

```

I also found in training class that you suggested:

```auto
nlu:
-synonym:credit
examples: |
- credit card account
- credit account?

```

the first one is from this udemy curs: [https://www.udemy.com/course/how-to-build-chatbot-with-python-rasa-open-source/?referralCode=495AF5CC2CDA2A2A2EAF](https://www.udemy.com/course/how-to-build-chatbot-with-python-rasa-open-source/?referralCode=495AF5CC2CDA2A2A2EAF)

and second one is from:

[![](https://img.youtube.com/vi/7nFXhd3AF78/maxresdefault.jpg "Conversational AI with Rasa: Entities") ](https://www.youtube.com/watch?v=7nFXhd3AF78)

are there more ways to provide plenty of examples to one entity? I know that there is a way as you said in “within the context of intents”(I can use synonyms in there) but there can be plenty of examples

and how about lookup table? those are the final list of all entities examples? It means that from others I can make my rasa learn and from those I can not, because it is final list?
