changed array_as_json to class method