Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  GetJsonObjectProperty fails if the object isn't present

    Posted 06-12-2025 21:19
    No replies, thread closed.

    Hi,

    Hoping to get some guidance on this issue from the community. 

    In architect, I am trying to read the value of an optional object in a JSON response using GetJsonObjectProperty function. It works great as long as the object is present in the JSON response. But fails when the JSON response is missing the specific object. 

    Has anyone experienced this issue before? If so, if you managed to find a workaround for the same?

    Thanks in advance.

    #Architect #FunctionInArchitect #ArchitectFunction


    #Routing(ACD/IVR)

    ------------------------------
    Dhanalakshmi Vasudevan
    ------------------------------


  • 2.  RE: GetJsonObjectProperty fails if the object isn't present
    Best Answer

    Posted 06-12-2025 22:05
    No replies, thread closed.

    I don't have a lot of experience with Json manipulation in architect but you could possibly try wrapping the GetJsonObjectProperty function in an If & IsNotSetOrEmpty functions so something like the below (full disclosure I haven't tested this so don't know if it would work)

    If(IsNotSetOrEmpty(GetJsonObjectProperty(Task.Json_Variable)),"NotFound",GetJsonObjectProperty(Task.Json_Variable))

    Or another way could be to use the GetJsonObjectPropertyNames() function to retrieve the names of the objects, and if the one your looking for isn't there you don't try to look it up.



    ------------------------------
    Cam Stone
    ------------------------------