title: How to Convert a list of dicts into nested JSON in python without using pandas DataFrame
body: <p>I have a list of dicts like this </p>
  
  <pre><code>[
    {
      "subject_id": 1,
      "subject_name": "HR Sector 0",
      "id": 1,
      "name": "parent2",
      "value": 10.6
    },
    {
      "subject_id": 18,
      "subject_name": "Test11",
      "id": 1,
      "name": "parent2",
      "value": 12
    },
    {
      "subject_id": 2,
      "subject_name": "AG1",
      "id": 2,
      "name": "Customer Delivery Dpt. 1",
      "value": 17
    },
    {
      "subject_id": 3,
      "subject_name": "Finance Group 2",
      "id": 2,
      "name": "Customer Delivery Dpt. 1",
      "value": 1.5
    },
    {
      "subject_id": 10,
      "subject_name": "test",
      "id": 2,
      "name": "Customer Delivery Dpt. 1",
      "value": 10
    },
    {
      "subject_id": null,
      "subject_name": null,
      "id": 3,
      "name": "Technology Team 2",
      "value": null
    },
    {
      "subject_id": 8,
      "subject_name": "Group 4",
      "id": 5,
      "name": "Accounting Group 4",
      "value": 10
    },
    {
      "subject_id": null,
      "subject_name": null,
      "id": 9,
      "name": "PG2",
      "value": null
    }
  ]
  </code></pre>
  
  <p>I want to convert it into nested JSON  and ignore null values to get below result set  </p>
  
  <pre><code>[
    {
      "id": 1,
      "name": "parent2",
      "subjects”: [
      {”subject_id": 1,
       "subject_name": "HR Sector 0",
          "value": 10.6
      },
      {”subject_id": 18,
       "subject_name": "Test11",
          "value": 12
      }
        ]
    },
    {
      "id": 2,
      "name": "Customer Delivery Dpt. 1",
      "subjects”: [
          {“subject_id": 2,
          "subject_name": "AG1",
          "value": 17
      },
       {“subject_id": 3,
          "subject_name": "Finance Group 2",
          "value": 1.5
      },
      {“subject_id": 10,
          "subject_name": “test”,
          "value": 10
      }
        ]
    },
    {
      "id": 3,
      "name": "Technology Team 2",
      "subjects”: []
    },
    {
      "id": 5,
      "name": "Accounting Group 4",
      "subjects” : [
          { "subject_id": 8,
          "subject_name": "Group 4",
          "value": 10
       }
        ]
    },
  {
      "id": 9,
      "name": "PG2",
      "subjects”: []
    }
  ]
  </code></pre>