Convert Text into Dictionary

Hello data conversion experts!

I am trying to convert some data that is being stored as a Text data type into a List of Dictionary data type. I've tried a few different things, such as converting to and from JSON (this gives me a List of Text output), and also tried casting the value. No luck. Has anyone managed to do this in an Appian expression rule?

Here's my current rule that seems to always return an empty Dictionary (note that ri!value is a Text Array):

cast(
194, /* magic number for type: 'List of Dictionary' */
ri!value
)

OriginalPostID-244347



  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    @mikej117 as per your requirement, the steps which you have mention for this solution is correct, there might be some small mistake. However for such requirement where i have a Text Data type which holds the JSON values, we can get that data back in List in Dictionary Format using a!fromJson() function, as i have tested it and working perfectly, below is the Code, please have a look on that which may help you to resolve your problem Statement

    ==================================================
    load(
    /*Storing Some Data Into local variable*/
    local!data: a!queryEntity(
    entity: cons!EmployeeDetailsConstant,
    query: a!query(
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 50
    )
    )
    ).data,

    /*Converting the data into JSON Text and storing into a local variable*/
    local!jsonData: a!toJson(local!data),

    /*To get the Type of local!jsonData*/
    /*typename(typeof(local!jsonData))*/

    /*Fetching the data from JSON Text to List of Dictionary Format*/
    a!fromJson(local!jsonData)

    )
    =========================================================

    I Hope this will Help You
Reply
  • 0
    Certified Lead Developer
    @mikej117 as per your requirement, the steps which you have mention for this solution is correct, there might be some small mistake. However for such requirement where i have a Text Data type which holds the JSON values, we can get that data back in List in Dictionary Format using a!fromJson() function, as i have tested it and working perfectly, below is the Code, please have a look on that which may help you to resolve your problem Statement

    ==================================================
    load(
    /*Storing Some Data Into local variable*/
    local!data: a!queryEntity(
    entity: cons!EmployeeDetailsConstant,
    query: a!query(
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 50
    )
    )
    ).data,

    /*Converting the data into JSON Text and storing into a local variable*/
    local!jsonData: a!toJson(local!data),

    /*To get the Type of local!jsonData*/
    /*typename(typeof(local!jsonData))*/

    /*Fetching the data from JSON Text to List of Dictionary Format*/
    a!fromJson(local!jsonData)

    )
    =========================================================

    I Hope this will Help You
Children
No Data