w3c / opentrack-cg

Repository for OpenTrack Community Group
https://w3c.github.io/opentrack-cg/spec/competition/
Other
27 stars 10 forks source link

Fix JSON in one of the examples #12

Closed tripu closed 7 years ago

tripu commented 7 years ago

The 6 files under /spec/model/examples/ are not valid JSON.

While these are just examples, and not intended to be correct, breaking the JSON spec causes a few minor inconveniences:

This PR “fixes” one of these examples. Validity can be checked eg using an online JSON validator/editor. Most browsers may display the file very differently, and editors won't complain. See the file on the browser (if your browser has a JSON extension, it will let you collapse/expand entire sections, highlight syntax, render URIs as hyperlinks, etc).

NB: inline comments that were deleted here will have to be put somewhere else (eg, a new text file just for this?).

@espinr, if you're happy about this change, I'll do the same with the other 5 files.

tripu commented 7 years ago

Notes to self:

  1. Check:

    $ find spec/ -iname '*.json' | xargs -n 1 jsonlint-php
  2. Fix quotes (if there are no legit occurrences of '):

    $ sed -i.bak "s/'/\"/gi" spec/model/examples/FILE.json
  3. Remove comments.

  4. Normalise formatting:

    const fs = require('fs');
    fs.readFile('spec/model/examples/FILE.json', (foo, data) => {
     fs.writeFile('spec/model/examples/FILE2.json', JSON.stringify(JSON.parse(data), null, 4) + '\n');
    });