sentry0 Posted February 17, 2018 Report Share Posted February 17, 2018 I'm attempting to build a JSON export template and am having some success so far. I've hit a bit of a snag though with characteristics not exporting properly...see the below snippet. <!--TEMPLATE_NAME-->6E JSON Export<!--/TEMPLATE_NAME--> <!--TEMPLATE_DESCRIPTION--> <p>A JSON template for the Hero System 6th Edition by sentry0</p> <p> Version 1.0.0 (2018-02-17) <!--FILE_EXTENSION-->json<!--/FILE_EXTENSION--> </p> <!--/TEMPLATE_DESCRIPTION--> { name: '<!--CHARACTER_NAME-->', characteristics: { strength: { total: '<!--STR--><!--STR_TOTAL--><!/--STR-->', cost: '<!--STR--><!--STR_COST--><!/--STR-->', roll: '<!--STR--><!--STR_ROLL--><!/--STR-->', notes: '<!--STR--><!--STR_NOTES--><!/--STR-->' } }, movement: { running: '<!--RUNNING--><!--RUNNING_TOTAL-->[<!--IF_RUNNING--><!--RUNNING_TOTAL_NONCOMBAT--><!--/IF_RUNNING--> NC]<!--/RUNNING-->' } } The "name" and "running" properties populate correctly but I can't seem to get any of the strength properties to work. Here's what HD is outputting for me: { name: 'Edward Lightbinder', characteristics: { strength: { total: '<!--STR--><!--STR_TOTAL--><!/--STR-->', cost: '<!--STR--><!--STR_COST--><!/--STR-->', roll: '<!--STR--><!--STR_ROLL--><!/--STR-->', notes: '<!--STR--><!--STR_NOTES--><!/--STR-->' } }, movement: { running: '6"[12" NC]' } } Quote Link to comment Share on other sites More sharing options...
Simon Posted February 17, 2018 Report Share Posted February 17, 2018 Edit: never mind -- it was simpler than what I originally posted. <!/--STR--> That's where your problem is. Replace it with the correct end tag: <!--/STR--> Quote Link to comment Share on other sites More sharing options...
sentry0 Posted February 17, 2018 Author Report Share Posted February 17, 2018 Awesome! Thanks so much for your help Quote Link to comment Share on other sites More sharing options...
sentry0 Posted February 17, 2018 Author Report Share Posted February 17, 2018 My export template is sort of working, it's producing invalid JSON because some fields contain a single quote which happens to be what I'm using to quote my values. I could switch to double quotes but it doesn't address the root issue which is if a player uses a single (or double quote) they will produce broken JSON. Is there anyway for my to get like an XML dump from HD that I could use for further parsing? Quote Link to comment Share on other sites More sharing options...
sentry0 Posted February 18, 2018 Author Report Share Posted February 18, 2018 I've settled on a tab separated dump...it's not pretty but it should work for what I need it to If there's a low effort way to get an XML dump out of HD I would much prefer that though. Quote Link to comment Share on other sites More sharing options...
Simon Posted February 18, 2018 Report Share Posted February 18, 2018 Not entirely sure what you're after...if you want HD to export XML, make and XML export format. Quote Link to comment Share on other sites More sharing options...
sentry0 Posted February 18, 2018 Author Report Share Posted February 18, 2018 What I was trying to say is if you have some magical way to get the data out of HD and into a machine readable format I would take it. If nothing like that exists then I'll just keep moving down the TSV path The XML format would have the same issue as JSON, it would actually probably be worse because of the amount of special characters you would have to watch out for. Quote Link to comment Share on other sites More sharing options...
Simon Posted February 18, 2018 Report Share Posted February 18, 2018 Still no clue what you're after. If you're worried about special characters in XML, you use <![CDATA[]]> Quote Link to comment Share on other sites More sharing options...
sentry0 Posted February 18, 2018 Author Report Share Posted February 18, 2018 Good point about the <![CDATA[]]> tags, totally forgot about that. It's cool, I'll create an XML template...thanks again for your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.