Validating JSON for Scripts
Using JSON for passing multiple parameters can be a real life saver. Because JSON keeps all individual parameters separate from each other, you can pass pretty much any type of data except for container data - although you can pass a reference to a container easily enough. Your parameters can also have as many levels as necessary and the JSON can easily be modified as it moves from script to script.
When writing a complex and large collection of scripts, you eventually hit errors and issues. You end up spending extra time hunting down problems and eventually you find out it's a simple issue where you just "forgot" to include that one additional item the script needed in order to handle the process properly.
This is where validation comes into play. It's a perfect solution for making sure your scripts work the way you expect them to. Rather than letting the script fail, then determining whether it really did fail or not, you're telling the script it MUST fail unless it has all the required parts.
Thus, a single script, with a multi-dimensional JSON validator is a wonderful tool to have for your complex scripting situations. In the associated video and technique file, you'll find a complex script which will save hours and hours of time by validating your JSON data before the script even tries to use it.
Click the title or link to this article to view the video.
There are no comments to display.