Prolog Lambda function in aws

I’m using:

SWI-Prolog version 8

I want the code to:

I send to a lambda developing with prolog a json Object in this json object i have a list of facts and properties.
We need to extract the facts array that is in the object and foo properties and loop the facts array to extarct values
How to send to the lambda the input of the predicate and the input is the json object and response

My code looks like this:

My json object

{
    "facts": [
        "myfact(XXXX).",
        "another(YYY)."
    ],
    "foo": "baar(Foo)",
    "fool" : 4
}

My lambda function

handler(json(Event), Context, Response) :-
  member(X, Event.get(facts)),
  term_string(A,X),
  assert(A), fail; true,
  prove([Event.get(foo)],R),
  Response = '{"isBase64Encoded" :false, "statusCode":200,"headers": { "headerName": "headerValue"},"body":"the result"}'.

I have the current answer first to deploy the lambda function that you have developed with prolog you need a provided runtime that’s yours which will allow the execution of this one on Aws. To recover the properties of the 'json object just Event.propertieName allows to get it and to iterate the array using recusion we can browse the list