Skip to main content
vempatir680997
December 4, 2024
Question

Unable to fetch the data from doc using AI skills

  • December 4, 2024
  • 3 replies
  • 0 views

Hello Appian Community,

I am currently using AI Skills in Appian to extract data from a document. The extracted data is being saved as text at the process model level. However, I need to convert this text into JSON format for further processing.

I attempted to use the a!fromJson() function to convert the text into JSON, but I am encountering an error during the conversion.

Here is what I have tried:

  • The extracted data is stored in a process variable of type Text (e.g., pv!extractedData).
  • I tried using a script task to convert the text to JSON using:
    appian
    Copy code
    a!fromJson(pv!extractedData)
  • However, this results in an error.

Error Details:

My Questions:

  1. How can I ensure the text data is valid JSON and successfully convert it?
  2. Are there specific considerations or configurations required when working with AI Skills and JSON data in process models?
  3. What are the best practices for handling such scenarios?

Any guidance or examples would be greatly appreciated!

3 replies

sandhyab4212
December 4, 2024

Hi [mention:2d3c185fea1b4a2ba4053184eca60c71:e9ed411860ed4f2ba0265705b8793d05] 

You are passing text as input to the Json function, JSON function doesn't accept text as input as per my knowledge, you can save the extracted data into a variable which is of type CDT, Records or map based on your convenience, after that convert the pv!variable(stored extracted data) into JSON.
try this once, hope you will get the expected output!

sandhyab4212
December 4, 2024

If you want to convert extracted data to JSON, use toJson() function, not fromJson() function

vempatir680997
December 4, 2024

ya ok thanks [mention:4eeacfeb32584dc5b78e58842099d00d:e9ed411860ed4f2ba0265705b8793d05]