# Localstorage get item keyword returns string instead of dict

**URL:** <https://forum.robotframework.org/t/localstorage-get-item-keyword-returns-string-instead-of-dict/7409>\
**Category:** Browser\
**Created:** [11 June 2024 11:13 UTC](https://forum.robotframework.org/t/localstorage-get-item-keyword-returns-string-instead-of-dict/7409 "2024-06-11T11:13:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [11 June 2024 11:13 UTC](https://forum.robotframework.org/t/localstorage-get-item-keyword-returns-string-instead-of-dict/7409/1 "2024-06-11T11:13:00Z")

</div>

On browser lib’s `LocalStorage Get Item` keyword, the value returned ins plain old string.

However, in my usecase, value for a given key is big nested json/dict.

I thought i could just use `${ls}=. Evaluate json.loads(${val}) modules=json` or `${ls}=. Evaluate json.loads('${val}') modules=json` but neither of these seem to work …

Point being that If i dont explitly convert ${ls} to dict, i cant access sub keys …

Now, ofcourse i can just pass the string to python keyword and json.loads() there and im all set so the question is more about browser lib itself for the usecase of json in the localstorage and evaluate keyword to convert the string into dict _as_ if i dont do that:

> String ‘${ls}’ used with invalid index ‘order’. To use ‘[order]’ as a literal value, it needs to be escaped like ‘[order]’.

---

<div class="post-metadata">

**Author:** ![Noordsestern](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/noordsestern/32/4270_2.png) [@Noordsestern](https://forum.robotframework.org/u/Noordsestern)\
**Post date:** [12 June 2024 20:54 UTC](https://forum.robotframework.org/t/localstorage-get-item-keyword-returns-string-instead-of-dict/7409/2 "2024-06-12T20:54:38Z")

</div>

Hi Rasjani,

my appologies if I misinterpret your request. Do I understand right that you would like to use a more Robo-thonic way to create a dict from a json-string?

As every python module can be a Robot Framework library, you can do the following:

```python
***Settings***
Library json # this is the ordinary python json module

***Test Case***
Demo Use Of JSON module
    ${val}= Get my json string
    # now call json.loads like a normal keyword
    ${ls}= Loads ${val}

```

`${ls}` should be a dictionary, now.

Regards,  
Markus
