On 10/27/2011 4:50 AM, mcepl wrote:
Hi,
I have here a simple script (https://gitorious.org/json_diff/mainline)
which makes a diff between two JSON files. So for JSON objects
{
"a": 1,
"b": 2,
"son": {
"name": "Janošek"
}
}
and
{
"a": 2,
"c": 3,
"daughter": {
"name": "Maruška"
}
}
it generates
{
"append": {
"c": 3,
"daughter": {
"name": "Maruška"
}
},
"remove": {
"b": 2,
"son": {
"name": "Janošek"
}
},
"update": {
"a": 2
}
}
(obvious problems with name conflicts between internal keys and the
investigated keys will be somehow addressed later; any simple Pythonic
suggestions how?)
Use '_append', etc, much like namedtuple does, for the same reason.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list