0

This is the sample data for which I'm trying to get the value:

InvoiceAccuracy: {
data: {
  accurate: {
    invoices: 52,
    name: "1"
  },
  corrected: {
    invoices: 10,
    name: "1"
  },
  inaccurate: {
    invoices: 20,
    name: "1"
  }
},
success: true

}

Using this function(Tried):

const chartData = InvoiceGenerationData.InvoiceAccuracy.data.map(
    value => ({
      label: value.name,
      value: value.invoices
    })
  );

I have found the way to get the dictionary data. Here is the solution:

 const chartData = Object.keys(
    InvoiceGenerationData.InvoiceAccuracy.data
  ).map(key => {
    return {
      label: key,
      value: InvoiceGenerationData.InvoiceAccuracy.data[key].invoices
    };
  });

0 Answers0