JSFiddle - React, Tailwind, and code Playground

by Dhruvang Gajjar

JavaScript

var a = {
  "EmailCoding": [{
      "LYT_ID": "1",
      "Time_Slot_ID": "1",
      "PID": "1",
      "Layout_Price": "0"
    },
    {
      "LYT_ID": "2",
      "Time_Slot_ID": "1",
      "PID": "1",
      "Layout_Price": "29"
    },
    {
      "LYT_ID": "3",
      "Time_Slot_ID": "1",
      "PID": "1",
      "Layout_Price": "29"
    },
    {
      "LYT_ID": "2",
      "Time_Slot_ID": "2",
      "PID": "1",
      "Layout_Price": "39"
    },
    {
      "LYT_ID": "3",
      "Time_Slot_ID": "2",
      "PID": "1",
      "Layout_Price": "39"
    },
    {
      "LYT_ID": "1",
      "Time_Slot_ID": "2",
      "PID": "1",
      "Layout_Price": "0"
    },
    {
      "LYT_ID": "1",
      "Time_Slot_ID": "3",
      "PID": "1",
      "Layout_Price": "0"
    },
    {
      "LYT_ID": "2",
      "Time_Slot_ID": "3",
      "PID": "1",
      "Layout_Price": "39"
    },
    {
      "LYT_ID": "3",
      "Time_Slot_ID": "3",
      "PID": "1",
      "Layout_Price": "39"
    },
    {
      "LYT_ID": "1",
      "Time_Slot_ID": "4",
      "PID": "1",
      "Layout_Price": "0"
    },
    {
      "LYT_ID": "2",
      "Time_Slot_ID": "4",
      "PID": "1",
      "Layout_Price": "39"
    },
    {
      "LYT_ID": "3",
      "Time_Slot_ID": "4",
      "PID": "1",
      "Layout_Price": "39"
    },
    {
      "LYT_ID": "2",
      "Time_Slot_ID": "5",
      "PID": "1",
      "Layout_Price": "39"
    },
    {
      "LYT_ID": "3",
      "Time_Slot_ID": "5",
      "PID": "1",
      "Layout_Price": "39"
    },
    {
      "LYT_ID": "1",
      "Time_Slot_ID": "5",
      "PID": "1",
      "Layout_Price": "0"
    }
  ]
};

var b = a.EmailCoding;
var tempA = {};
b.filter((el, i) => {
	tempA[el.LYT_ID] = tempA[el.LYT_ID] || {};
  tempA[el.LYT_ID][el.Time_Slot_ID] = el;
})

console.log(tempA);