def _dict_to_item()

in src/vw-serving/src/vw_serving/dynamodb_client_wrapper.py [0:0]


    def _dict_to_item(input_json):
        if input_json == '' or not input_json:
            return {
                "NULL": True
            }
        if type(input_json) is dict:
            resp = {}
            for k, v in input_json.items():
                resp[k] = DynamoDbClientWrapper._dict_to_item(v)
            return {
                "M": resp
            }
        if type(input_json) is list:
            list_items = []
            for i in input_json:
                list_items.append(DynamoDbClientWrapper._dict_to_item(i))
            return {
                "L": list_items
            }
        if type(input_json) is str:
            return {
                "S": input_json
            }
        if type(input_json) is int or type(input_json) is float:
            return {
                "N": str(input_json)
            }