GEOS-5246-5247 JSON cumulative patch [backport]

This patch is the cumulative backport for:
https://github.com/geoserver/geoserver/pull/23
https://github.com/geoserver/geoserver/pull/24
https://github.com/geoserver/geoserver/pull/41

Cheers,
Carlo