It's more a problem with the parser, but brought about by Cargo so forgive me if I'm adding against the wrong project.
If {{#cargo_display_map}} is used inline, then the JSON.parse error above is raised. This is because with this wikitext:
* Coordinates: {{#if: {{{coordinates|}}} | {{{coordinates}}} {{#cargo_display_map: |point={{{coordinates|}}} |width=800 }} }}
This sort of HTML is produced:
<li> Coordinates: -32.066229, 115.76116 <div style="height: 400px; width: 800px" class="mapCanvas" id="mapCanvas1"></li></ul> <div class="cargoMapData" style="display: none" mappingservice="OpenLayers">[{"name":-32.066229,"title":null,"lat":-32.066229,"lon":115.76116,"otherValues":[]}]</div> </div>
Which confuses JSON.parse for some weird reason. If the wikitext is given a couple of newlines:
* Coordinates: {{#if: {{{coordinates|}}} | {{{coordinates}}} {{#cargo_display_map: |point={{{coordinates|}}} |width=800 }} }}
Everything's fine.
I wondered if perhaps the cargoMapData could instead be defined as a JS variable, and so avoid the need of parsing?