In <dcd42df5-4cfa-423f-82e1-442cc6c75...@googlegroups.com> hisan 
<santosh.s...@gmail.com> writes:

> sample_json1={{
>        "globalControlId": 72,
>        "value": 0,
>        "controlId": 2
>    },
>    {
>        "globalControlId": 77,
>        "value": 3,
>        "controlId": 7
>    }
> }

> sample_json2={
>    {
>        "globalControlId": 77,
>        "value": 3,
>        "controlId": 7
>    },
>     {
>        "globalControlId": 72,
>        "value": 0,
>        "controlId": 2
>    }
> }

Assuming you have valid json strings (which these aren't), I think you
could convert them into python objects with json.loads() and then compare
the python objects.

For example:

>>> import json
>>> json1 = '{"color": "blue", "amount": 10}'
>>> json2 = '{"amount": 10, "color": "blue"}'
>>> python1 = json.loads(json1)
>>> python2 = json.loads(json2)
>>> print python1 == python2
True
>>>

-- 
John Gordon                   A is for Amy, who fell down the stairs
gor...@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to