<div dir="ltr"><div>The JSON template has <b>[feature trimlast=","]</b> for a single layer that may return multiple records, but I don't see that functionality for the whole JSON object. For example if I have two layers but only one returns results I end up with a trailing comma and invalid JSON.<br>
<br>// MapServer template<br>{<br>  [resultset layer=layer1]<br>  {<br>    [feature trimlast=","]<br>    { ... }<br>    [/feature]<br></div><div>  },   <span style="color:rgb(56,118,29)">// might need to trim this comma if layer below doesn't return result</span><br>
</div><div>  [/resultset]<br><br>  [resultset layer=layer2]<br>  {<br>    [feature trimlast=","]<br>    { ... }<br>    [/feature]<br>  }   <span style="color:rgb(56,118,29)">// no comma here because we think it's last result object</span><br>
  [/resultset]<br>}<br><br></div><div>I can work around it by putting a comma and empty object at the end:<br>   ,{}<br></div><div>which is the way I've done it when writing JSON with standard templates, but that's sort of inconsistent with the [feature trimlast=","] option.<br>
<br></div><div>Am I missing anything? Should I file a feature enhancement request?<br><br></div><div>And trimlast="," does seem to need to require double, not single quotes.<br><br></div><div>Thanks,<br>Rich<br>
</div><div><br><br><div>-- <br>Richard Greenwood<br><a href="mailto:richard.greenwood@gmail.com">richard.greenwood@gmail.com</a><br><a href="http://www.greenwoodmap.com">www.greenwoodmap.com</a>
</div></div></div>