def mapper_json_api(model: type, resource: dict) ->object:
    """
    Returns an obj of type `model` from dictified JSON `resource` for JSON APIs
    """
    attr = dict()
    for field in model._fields:
        if field == 'id':
            attr[field] = resource['data']['id']
        else:
            attr[field] = resource['data']['attributes'][field.replace('_',
                '-')]
    return model(**attr)
