Legacy Dev Forum Posts

 View Only

Sign Up

Integration/ Data Action/ JSON Mapping/ PopUp Scripts - Issue

  • 1.  Integration/ Data Action/ JSON Mapping/ PopUp Scripts - Issue

    Posted 06-05-2025 18:40

    alialjohani | 2018-08-22 10:38:55 UTC | #1

    Hello Everyone,

    I would like to ask about JSON mapping to dynamic number of objects. How this can be done? Any example/ resources?

    As an example, we can use the following URL "https://jsonplaceholder.typicode.com/posts?userId=1" with the Postman with GET method, the response would be something similar to the following:

    [ { "userId": 1, "id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", "body": "quia et suscipit\nsuscipit" }, { "userId": 1, "id": 2, "title": "qui est esse", "body": "est rerum tempore vitae\nsequi sint " }]

    So, as you can see, there are multiple objects,. However, the error message I always get from PureCloud is: { "status": 400, "code": "invalid.extraction.into.translation.map", "message": "There was an issue extracting a value from the remote endpoint's response into the response translation map. Cause: Expected to find an object with property ['id'] in path $ but found 'java.util.ArrayList'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.", "messageParams": {}, "contextId": "65e04558-8c48-43ef-b281-5b15e70e6f93", "details": [], "errors": [] }

    On other hand, when I work only with single object, in which the response does not start with "[", it works successfully.

    Please, any idea, or suggestion can be helpful.

    Thank you,


    anon28066628 | 2018-08-17 13:57:19 UTC | #2

    Hi Ali,

    Take a look at this article, it may help with processing multiple records:

    https://developer.mypurecloud.com/forum/t/process-multiple-array-of-contacts-or-accounts-from-a-salesforce-data-action/2274


    Jason_Mathison | 2018-08-20 14:27:32 UTC | #3

    As a note on the "invalid.extraction.into.translation.map" error that you are getting. I highly recommend grabbing the results you are getting from the execution and pasting those into a site like http://jsonpath.com/ and working through the JSONPath that you are using to populate the translation map.

    This isn't a site we have any affiliation with, so I would definitely redact anything sensitive.

    As an example, if you wanted to get an array of all of the titles you could use this for your JSONPath

    $.*.title

    --Jason


    alialjohani | 2018-08-22 10:29:01 UTC | #4

    Dear Smith,

    Thank you very much for the feedback. I have more questions related to popup scripts. How I could display all the objects in the array on Pop-up Scripts? Is there a loop statement in the popup script that I can use?

    I would like to GET these objects, and these will be displayed for Agents as a down-list/ checkbox / ets, for further process!!

    Thank you and best regards,

    Ali Aljohani


    alialjohani | 2018-08-22 10:34:41 UTC | #5

    Dear Jason,

    Thank you very much for the feedback. Even though, I am stuck to access my second object from the following Json structure:

    [ { "userId": 1, "id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", "body": "quia et suscipit\nsuscipit" }, { "userId": 1, "id": 2, "title": "qui est esse", "body": "est rerum tempore vitae\nsequi sint " }]

    your advise is really helpful, that JSOPath evaluation has to be the starting point regarding transition map.

    Thank you very much, Best Regards, Ali Aljohani


    Jason_Mathison | 2018-08-22 12:03:48 UTC | #6

    This JSONPath expression will return the second entry in the array: $.[1]

    Here is a good tutorial on using JSONPath: http://goessner.net/articles/JsonPath/index.html#e2


    anon28066628 | 2018-08-22 13:27:19 UTC | #7

    Hi Ali,

    I'm not as familiar with scripts, but I don't believe adding UI components dynamically, such as in a loop, is possible. I have seen scripts were up to 'x' fields are pre-allocated, maybe 5, where some get used and some are left blank.


    alialjohani | 2018-08-27 09:00:50 UTC | #8

    Thank you Jason, I did not notice about indexing from 0.

    Thank you again and all the best, Ali Aljohani


    alialjohani | 2018-08-27 09:03:45 UTC | #9

    Thank you Smith, This is what I am aware of. I don't think script support loops. However, I will try your idea of setting a fixed number of fields to deal with the recent, for now.

    Thank you again Smith, All the best, Ali Aljohani


    system | 2018-09-27 09:15:26 UTC | #10

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 3386