The first check is unnecessary because CJSONServiceDescription will already make sure "mode" is a string. If you can specify an "enum" with all the possible values (as mentioned in my previous comment) you could also drop the second check.