backporting changes from master to the JSON_P-1.0 branch

fixes: #21
txs to jgallimore for the patch!
Applied with slight changes.

This includes the following tickets, and likely a few more:
JOHNZON-156
JOHNZON-142
JOHNZON-135
JOHNZON-133
JOHNZON-123

For more history please analyse the master branch for the original changes.
133 files changed