also allow non array data to be JSON encoded, add an isJson static method