0

I need some help in converting a json to csv format. Its has 1 value with multiple properties for the same value. Can someone help me in this.

JSON:

{
  "Parts": [{
    "PartID": "P9",
    "PartName": "SP9",
    "Max": 10,
    "Min": 2,
    "VersionAva": ["PartLog"],
    "TimeProperties": {
      "(1)": {
        "X": 1731.92,
        "Y": 0.0,
        "Z": 0.0,
        "PartLogValues": []
      },
      "(2)": {
        "X": 1732.22,
        "Y": 4.3591343397810371,
        "Z": 5.33,
        "PartLogValues": []
      },
      "(3)": {
        "X": 1732.37,
        "Y": 4.3591343397810371,
        "Z": 5.33,
        "PartLogValues": [
          "NaN"
        ]
      },
      "(4)": {
        "X": 1733.44,
        "Y": 4.3589598068558377,
        "Z": 5.31,
        "PartLogValues": [
          213
        ]
      },
      "(5)": {
        "X": 1733.9,
        "Y": 4.3587852739306392,
        "Z": 5.3,
        "PartLogValues": [
          4, 8, 9
        ]
      }
    }
  }]
}    

CSV Output as:

    PartID  PartName    Max Min TimeProperties  X   Y   Z   PartLogValues-  PartLogValues001    PartLogValues002    PartLogValues003
P9  SP9 10  2   1   1731.92 0   0               
P9  SP9 10  2   2   1732.22 4.35913434  5.33                
P9  SP9 10  2   3   1732.37 4.35913434  5.33                
P9  SP9 10  2   4   1733.44 4.358959807 5.31    NaN         
P9  SP9 10  2   5   1733.9  4.358785274 5.3 213 4   8   9
MattDMo
  • 100,794
  • 21
  • 241
  • 231
user3470294
  • 190
  • 1
  • 1
  • 12
  • 3
    possible duplicate of [convert from json to csv using python](http://stackoverflow.com/questions/1871524/convert-from-json-to-csv-using-python) – taesu Feb 16 '15 at 00:18
  • The above JSON has 1 name with multiple properties. If i use other examples, i get only 1 name. I want the names to be repeated for all the properties. – user3470294 Feb 16 '15 at 04:41

0 Answers0