Check if the args is a valid JSON object

* Since args has `id` as type we need to ensure that is a valid JSON,
otherwise an exception will be thrown.
* It also add an enum for the error code