How to convert Text Data returned from an Execute Gen AI Skill into a Map/Dictionary

Certified Associate Developer

Hi Experts,

Please help me to resolve my issue.

I want to convert the following data returned in "Text" format into a list of dictionary/map and afterwards map these fields to a CDT.

{ "IPAddress": "111.101.1111.11", "StartDate": "2024/06/26", "StartTime": "23:24:49", "StartTimezone": "UTC", "EndDate": "2024/06/28", "EndTime": "17:38:12", "EndTimezone": "UTC" }& { "IPAddress": "111.111.1101.11", "StartDate": "2024/07/02", "StartTime": "02:52:07", "StartTimezone": "UTC" }& { "IPAddress": "111.111.1110.11", "StartDate": "2024/07/07", "StartTime": "18:10:37", "StartTimezone": "UTC", "EndDate": "2024/07/09", "EndTime": "03:50:30", "EndTimezone": "UTC" }& { "IPAddress": "111.111.1111.10", "StartDate": "2024/07/16", "StartTime": "07:36:39", "StartTimezone": "UTC", "EndDate": "2024/07/17", "EndTime": "23:01:19", "EndTimezone": "UTC" }

Appreciate your help!

  Discussion posts and replies are publicly visible

Parents
  • In my experience if your prompt is written properly, you would get the values in JSON format it self. 
    Example could be

    when I pass a text, map my text to below json schema.


    {
    "$schema": "">json-schema.org/.../schema
    "type": "array",
    "items": {
    "type": "object",
    "properties": {
    "IPAddress": {
    "type": "string"
    },
    "StartDate": {
    "type": "string",
    "format": "date"
    },
    "StartTime": {
    "type": "string",
    "format": "time"
    },
    "StartTimezone": {
    "type": "string"
    },
    "EndDate": {
    "type": "string",
    "format": "date"
    },
    "EndTime": {
    "type": "string",
    "format": "time"
    },
    "EndTimezone": {
    "type": "string"
    }
    },
    "required": [
    "IPAddress",
    "StartDate",
    "StartTime",
    "StartTimezone"
    ],
    "additionalProperties": false
    }
    }

Reply
  • In my experience if your prompt is written properly, you would get the values in JSON format it self. 
    Example could be

    when I pass a text, map my text to below json schema.


    {
    "$schema": "">json-schema.org/.../schema
    "type": "array",
    "items": {
    "type": "object",
    "properties": {
    "IPAddress": {
    "type": "string"
    },
    "StartDate": {
    "type": "string",
    "format": "date"
    },
    "StartTime": {
    "type": "string",
    "format": "time"
    },
    "StartTimezone": {
    "type": "string"
    },
    "EndDate": {
    "type": "string",
    "format": "date"
    },
    "EndTime": {
    "type": "string",
    "format": "time"
    },
    "EndTimezone": {
    "type": "string"
    }
    },
    "required": [
    "IPAddress",
    "StartDate",
    "StartTime",
    "StartTimezone"
    ],
    "additionalProperties": false
    }
    }

Children