def METHOD_NAME(parent, field, request, serializer):
    json_serializer = serializer()
    data = json_serializer.validate(request.data)
    # create file object
    with open(json_serializer.filenmame, 'wb+') as f:
        in_memory_file = UploadedFile(
            file=f,
            name=json_serializer.filenmame,
            content_type='application/json',
            size=len(data.encode('utf-8')),
            charset=None
        )
    # wrap and re-open file
    file_obj = QueryDict('', mutable=True)
    file_obj.update({'file': in_memory_file})
    file_obj['file'].open()
    file_obj['file'].seek(0)
    file_obj['file'].write(data.encode('utf-8'))
    serializer = RelatedFileSerializer(
        data=file_obj,
        content_types='application/json',
        context={'request': request}
    )
    serializer.is_valid(raise_exception=True)
    instance = serializer.create(serializer.validated_data)
    # Check for exisiting file and delete
    _delete_related_file(parent, field, request.user)
    setattr(parent, field, instance)
    parent.save(update_fields=[field])
    # Override 'file' return to hide storage details with stored filename
    response = Response(RelatedFileSerializer(instance=instance, content_types='application/json').data)
    response.data['file'] = instance.file.name
    return response