Samyukta,
Legends are shown for each dataSeries with a marker and the text. In your case, it shows same name in multiple colors as you are passing same name to multiple dataSeries. Parsing JSON properly and passing legendText / name according to the dataSeries that you are creating dynamically should work fine. Please take a look at this JSFiddle for an example on multi-series chart from JSON file.
—
Manoj Mohan
Team CanvasJS