Skip to content

JSON import incorrectly parses labels with HTML entities #210

@nk9

Description

@nk9

Expected behaviour

When you import a .json file saved by Highcharts, I expect the chart to be recreated as it was when the chart was saved.

Actual behaviour

If the saved data contains semicolons in the labels (for example if HTML entities are used), the data will be parsed incorrectly and the graph will not be reproduced as it was when it was saved.

Reproduction steps

  • Visit the Highcharts editor.
  • Press the Open button in the toolbar.
  • Import this json as a file:
{"template":{"chart":{"type":"line"}},"options":{"series":[{"data":[["a",4],["b–b",5],["c",6]],"name":"col1, thx","turboThreshold":0},{"data":[["a",4],["b–b",4],["c",3]],"name":"col2","turboThreshold":0},{"data":[["a",3],["b–b",5],["c",7]],"name":"col3","turboThreshold":0}],"data":{"csv":"\"null\";\"col1, thx\";\"col2\";\"col3\"\n\"a\";4;4;3\n\"b–b\";5;4;5\n\"c\";6;3;7"},"yAxis":[{}],"pane":{"background":[]},"responsive":{"rules":[]},"tooltip":{"useHTML":true},"xAxis":[{"title":{"useHTML":true},"labels":{"useHTML":true}}]},"customCode":"/*\n// Sample of extending options:\nHighcharts.merge(true, options, {\n    chart: {\n        backgroundColor: \"#bada55\"\n    },\n    plotOptions: {\n        series: {\n            cursor: \"pointer\",\n            events: {\n                click: function(event) {\n                    alert(this.name + \" clicked\\n\" +\n                          \"Alt: \" + event.altKey + \"\\n\" +\n                          \"Control: \" + event.ctrlKey + \"\\n\" +\n                          \"Shift: \" + event.shiftKey + \"\\n\");\n                }\n            }\n        }\n    }\n});\n*/","theme":false,"settings":{"constructor":"Chart","dataProvider":{"csv":"\"null\";\"col1, thx\";\"col2\";\"col3\"\n\"a\";4;4;3\n\"b–b\";5;4;5\n\"c\";6;3;7","googleSpreadsheet":false,"liveData":false}}}

Editor version

Whatever is live on the website.

Affected browser(s)

All, this isn't a browser issue.

Images

Before round trip:
Screenshot 2020-06-12 at 12 08 22

After round trip:
Screenshot 2020-06-12 at 12 10 44

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions