Display Dictionary Values in Template

How to display following dictionary in template:
inventory = {'1': "{'Name': 'Server1', 'IP': '192.168.1.1', 'Version': 'Win'}", '2': "{'Name': 'Server2', 'IP': '192.168.1.2', 'Version': 'Linux'}", '3': "{'Name': 'Server3', 'IP': '192.168.1.3', 'Version': 'Win'}"}

I want to display in following format in HTML but I cannot figure it out:

Hostname        IP                       Version
Server1           192.168.1.1        Win
Server2           192.168.1.2        Linux
Server3           192.168.1.3        Win

I tried following method:
Views.py:
return render(request, 'inventory.html', inventory)

Template:

    {% for i in inventory.values %}
        {% for Name, IP, Version in i.items %}
        <tr>
        <td>{{ Name }}</td>
        <td>{{ IP }}</td>
        <td>{{ Version }}</td>
        </tr>
        {% endfor %}
   {% endfor %}

Side Note: When posting code or templates here, surround the code (or template) between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep the text properly formatted.
(I’ve taken the liberty of fixing your original post for this.)

This is a good start.

Your first iteration through this outer loop will set i to:

Now, this is an issue in that this is a string, and not a dict. Trying to use this in the template is going to be extremely problematic.

So the first thing you’ll want to do is ensure that the values in the inventory dict are also of type dict:

`inventory = {‘1’: {‘Name’: ‘Server1’, ‘IP’: ‘192.168.1.1’, ‘Version’: ‘Win’}, ‘2’: {‘Name’: ‘Server2’, ‘IP’: ‘192.168.1.2’, ‘Version’: ‘Linux’}, ‘3’: {‘Name’: ‘Server3’, ‘IP’: ‘192.168.1.3’, ‘Version’: ‘Win’}}

Now that you’ve got the right types, i would have the value {'Name': 'Server1', 'IP': '192.168.1.1', 'Version': 'Win'}

Because this is a dict, you won’t be iterating over it. You’ll access the values as i.Name, etc.

Review the docs at The Django template language | Django documentation | Django for more details.