# How to compare is json data is subset of another large json data using Robot framework?

**URL:** <https://forum.robotframework.org/t/how-to-compare-is-json-data-is-subset-of-another-large-json-data-using-robot-framework/6296>\
**Category:** Robot Framework\
**Created:** [4 October 2023 16:14 UTC](https://forum.robotframework.org/t/how-to-compare-is-json-data-is-subset-of-another-large-json-data-using-robot-framework/6296 "2023-10-04T16:14:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adhavan](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@Adhavan](https://forum.robotframework.org/u/Adhavan)\
**Post date:** [4 October 2023 16:14 UTC](https://forum.robotframework.org/t/how-to-compare-is-json-data-is-subset-of-another-large-json-data-using-robot-framework/6296/1 "2023-10-04T16:14:05Z")

</div>

How to compare is json data is subset of another large json data using Robot framework ?

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [5 October 2023 00:36 UTC](https://forum.robotframework.org/t/how-to-compare-is-json-data-is-subset-of-another-large-json-data-using-robot-framework/6296/2 "2023-10-05T00:36:22Z")

</div>

Hi @Adhavan,

Robot Framework uses python for conditional evaluation, so the same as you would in python.

Here are some examples (you can just save this as is to a .robot file and run it to see the results)

```python
***Variables***
@{Fruits} Strawberry Durian Apple Guava Blueberry Papaya Tomato Avocado Orange
&{fruitstand} Strawberry=65 Durian=13 Apple=15 Guava=5 Blueberry=100 Papaya=8 Tomato=88 Avocado=99 Orange=44
&{cars} Citroën=2 Peugeot=0 Daihatsu=1 Toyota=1 Mazda=2 Honda=1
&{drinks} Coffee=White Tea=Green Beer=Yellow Wine=Red
@{listdic} &{fruitstand} &{cars} &{drinks}

***Test Cases***
Item in List
	${mybool}= Evaluate "Avocado" in ${Fruits}
	IF "Tomato" in ${Fruits}
		Log Fresh Tomato on toast
	END

Key in Dictonary
	${mybool}= Evaluate "Blueberry" in ${fruitstand}

Value in Dictonary
	${mybool}= Evaluate "13" in ${fruitstand}.values()
	${mybool}= Evaluate "69" in ${fruitstand}.values()

Dictonary in List
	${mybool}= Evaluate ${drinks} in ${listdic}

```

Hope that helps,

Dave.

---

<div class="post-metadata">

**Author:** ![Adhavan](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@Adhavan](https://forum.robotframework.org/u/Adhavan)\
**Post date:** [5 October 2023 07:30 UTC](https://forum.robotframework.org/t/how-to-compare-is-json-data-is-subset-of-another-large-json-data-using-robot-framework/6296/3 "2023-10-05T07:30:15Z")

</div>

Thanks Dave ! I will try it

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [5 October 2023 09:39 UTC](https://forum.robotframework.org/t/how-to-compare-is-json-data-is-subset-of-another-large-json-data-using-robot-framework/6296/4 "2023-10-05T09:39:32Z")

</div>

Hi @Adhavan,

I forgot to mention

If you are using [Requests Library](https://marketsquare.github.io/robotframework-requests/doc/RequestsLibrary.html) it handles the conversion of the json string data into dictionary/list objects and back again for you

Otherwise there is [jsonlibrary](https://github.com/robotframework-thailand/robotframework-jsonlibrary) for converting json files / strings into dictionary/list objects and back again

Alternatively you can use the native json python module in robot framework as shown in the accepted answer in this [stackoverflow thread](https://stackoverflow.com/questions/35262216/json-handling-in-robot)

Or the [Robocorp json](https://rpaframework.org/libraries/json/) library

So many options 😁

Dave.

---

<div class="post-metadata">

**Author:** ![Adhavan](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@Adhavan](https://forum.robotframework.org/u/Adhavan)\
**Post date:** [5 October 2023 09:46 UTC](https://forum.robotframework.org/t/how-to-compare-is-json-data-is-subset-of-another-large-json-data-using-robot-framework/6296/5 "2023-10-05T09:46:38Z")

</div>

okay…i will try out this options thanks again
