I’m working on an Xtension and beginning to get frustrated with NAC’s treatment of quotes in JSON responses. I’m hoping that I’ve overlooked something, and that there’s a way to handle this without have to clean up the response that NAC produces.
The API response is an array of objects with the id/name properties, looking like this:
u
{
"id": "20230205|32000|1",
"name": "AdHoc"
},
{
"id": "20230206|32000|1",
"name": "AdHoc"
}
]
When NAC get’s this result through the xtension, the variables tab looks like this, which appears correct to me:
However, when I log the “DailySchedule” collection to the instance details, it looks like this:
s"{\"id\":\"20230205|32000|1\",\"name\":\"AdHoc\"}","{\"id\":\"20230206|32000|1\",\"name\":\"AdHoc\"}"]
When comparing that result with the actual API response above, I see that NAC is surrounding each object in quotes, as well as escaping quotes for each property.
Unfortunately, this prevents the “Query JSON” action from working, as the Id/Name properties aren’t proper JSON that can be fetched. I can clean this up using a couple different methods that involve additional actions… but I’m hoping I’m missing something so that I don’t have to do that. I have a very limited knowledge of OpenAPI 2.0 and Xtensions, so that certainly could be the case. My goal with creating the Xtension was to make these 3rd party API calls easy. But, if other users need to remember what actions to add to clean up NAC’s formatting, it doesn’t help achieve that goal near as much as I’d like.
Does anyone have any suggestions on if I’m missing something?
Thank you!