Handle invalid JSON filters from the input gracefully

When there is a invalid JSON string on the input for e.g. query-alarm-history
at present the exception raised is un-caught causing a internal error
with a HTTP error 500 returned to the client. This fix will handle those
errors and return 400 error with proper message indicating the failure.

Change-Id: Icd81a88f2c29a8baf7993325bf423435f1ad0924
Closes-Bug: 1366215
Merge "Handle invalid JSON filters from the input gracefully"