Prettify JSON tests and minimize diffs

Use the pretty JSON writer to generate the script_valid and script_invalid json tests. In addition, reuse the exisiting JSON data when it matches new tests, to minimize diffs on update.