Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  Facing error while parsing JSON in Architect

    NEW MEMBER
    Posted 21 days ago
    Edited by Sai Kumar 21 days ago

    Hello Genesys Cloud Community,

    I am currently working with a JSON object (assigned to a variable Task.myJson) in Genesys Cloud Architect and have successfully parsed individual fields like "name." However, I'm encountering difficulties when trying to extract a collection of phone numbers from the following JSON structure:

    {
    "name": "John Doe",
    "phoneNumbers": [
       
    {

          "type": "home",
         
    "number": "555-555-5555"

        },

        {

          "type": "work",

          "number": "555-555-1234"

        }

      ],

      "hobbies": ["reading", "hiking", "coding"]

    }


    While I'm able to parse the "name" field, I'm getting error while parsing array of phone numbers. Any guidance or suggestions on how to achieve this in Architect would be greatly appreciated.

    I need to extract the phone numbers in the following format:

    [
    "555-555-5555",
    "555-555-1234"
    ]


    #Routing(ACD/IVR)
    #Unsure/Other

    ------------------------------
    Sai Kumar
    Cognizant Technology Solutions India Private Limited
    ------------------------------



  • 2.  RE: Facing error while parsing JSON in Architect
    Best Answer

    GENESYS
    Posted 21 days ago

    Hello Sai,

    Welcome to the Community. I was trying to recreate your setup but it looks like I was encountering the same issue as you were in your screenshots. Could you open a case with our Architect and Routing team in Customer Care and let us know what they are able to find?



    ------------------------------
    Jason Kleitz
    Genesys - Employees
    ------------------------------



  • 3.  RE: Facing error while parsing JSON in Architect

    NEW MEMBER
    Posted 19 days ago

    Hi Jason, 

    Thank you for looking into this issue.

    After seeing your reply, I tried to open an account in customer care support portal and today I'm able to login into it but unfortunately I don't have access to open a case in it. 

    Could you please help me creating a case in customer care support portal from your account if possible?



    ------------------------------
    Sai Kumar
    Cognizant Technology Solutions India Private Limited
    ------------------------------



  • 4.  RE: Facing error while parsing JSON in Architect

    Top 25 Contributor
    Posted 21 days ago

    I struggle with this too. Imagine the case where you have multiple home phones, and you specifically want just home phone numbers. How do you do this? I ended up just updating my data action to return arrays instead. But would really like to learn and figure this out too, currently it feels like dealing with Arrays in Json is harder than it should be. But might just be a learning thing. 

    The best I have thought through (not tested out yet) is Creating a Collection JSON object of phoneNumbers and then using a loop to iterate through and pulling out the numbers. Using the find FindJsonArrayItem to get the index if looking for specific type.

    But feel like there has to be an easier way.

    If you figure it out please share.



    ------------------------------
    Anton Vroon
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources