How change JSON format Javascript : I want to change the format of my JSON to another. My problem is that for each object, I have to create up to three different objects

 
    
    
my JSON input:

    [{date:"21-05", cash: "500", card:"200", points:"100"},
      {date: "26-05", card:"100", points:"50"}
    ]

JSON output:

    [{date: "21-05", amount:"500", paymentType:cash}, 
    
    {date: "21-05", amount: "200", paymentType: card}, 
    
    {date: "21-05", amount: "200", paymentType: points}, 
    
    {date: "26-05", amount: "100", paymentType: card}, 
    
    {date: "26-05", amount: "50", paymentType: points}]

cash, card, point are global const
