can someone shed some lights on how to do this in Python language? There are 2 json documents to compare for the pins direction for the same cell. Each json document will have a list of cell, where each cell having a list of pin list with its respective pin direction, how do I compare the data?
Json 1:
cellA pin1 in
CellA pin2 in
CellA pin3 out
CellB pin1 in
CellB pin2 out
Json 2:
cellA pin1 out
cellA pin2 in
cellA pin3 out
cellB pin1 in
For above 2 cells, Python should indicate mismatches, how should I compare the two? As far, I managed to get each cell on its respective pin and direction but I'm not sure how to compare the two so that in the log show errors in this syntax.
Mismatch [cellA] [pin] [direction_frm_json_1] [direction_frm_json_2]
Thank you in advanced.
Updated for sample json. Json Type 1:
{
"cell_name": "cellA",
"pins": [
{
"attributes": [
"DIRECTION in ;",
"Comment line ;"
],
"name": "a"
},
{
"attributes": [
"DIRECTION in ;",
"Comment line ;"
],
"name": "b"
},
{
"attributes": [
"DIRECTION out ;",
"Comment line ;"
],
"name": "o"
},
{
"attributes": [
"DIRECTION inout ;",
"Comment line ;"
],
"name": "vcc"
},
{
"attributes": [
"DIRECTION inout ;",
"Comment line ;"
],
"name": "vss"
},
],
"sessionid": "grace_test",
"time_stamp": 1505972674.332383,
"file_type": "file1"
}
Json Type 2:
{'cell_name': 'cellA',
'power_pin': [{'direction': ['inout'],
name': 'vcc',
},
{'direction': ['inout'],
'name': 'vss',
}],
'pin': [{'direction': ['out'],
'name': 'a',
},
{'direction': ['in'],
'name': 'b',
},
{'direction': ['out'],
'name': 'o',
}],
"sessionid": "grace_test",
"time_stamp": 1505885461.0,
"file_type": "file2"
}