Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Using SRP_Json PARSE when a member has an unusual name.

In the following code snippet the first part fails and the second step works perfectly. Does anyone see just what I am doing wrong? Unless I have missed something (probably) the only thing I can figure out is that the SRP_Json command does not like the @odata.nextLink. After the code I have added a sample of what Postman returns.

If SRP_Json(objResponse, 'Parse', Response) EQ '' then
Response = ''
Members = SRP_Json(objResponse, 'GetMembers')
*** Members has an @FM delimited list of "@odata.context" :@FM: "value" :@FM: "@odata.nextLink"

***** The following fails to populate LinkItems
NextLinkResponse = SRP_Json(objResponse, "GETVALUE", "@odata.nextLink")
ParseResult = SRP_Json(hndlLink, "PARSE", NextLinkResponse)
LinkItems = SRP_Json(hndlLink, 'GetElements')

****** This works perfectly populating objItems.
ValuesResponse = SRP_Json(objResponse, "GETVALUE", "value")
ParseResult = SRP_Json(hndlItems, "PARSE", ValuesResponse)
objItems = SRP_Json(hndlItems, 'GetElements')

If objItems NE '' then
For Each objItem in objItems using @FM
Response := SRP_Json(objItem, 'GetValue', 'Sku') : @VM
Response := SRP_Json(objItem, 'GetValue', 'ID') : @FM
SRP_Json(objItem, 'Release')
Next objItem
Response[-1, 1] = ''
SRP_Json(objResponse, 'Release')

POSTMAN results

"@odata.context": "https://api.channeladvisor.com/v1/$metadata#Products(Sku,ID)",
"value": [
"Sku": "BO_ABALONE",
"ID": 1756251
"Sku": "AC_016-DPS",
"ID": 1756255
"Sku": "AC_016000",
"ID": 1756256

Sku and ID repeat 100 times. I am trying to retriece the URL that is in the last line.

"Sku": "AC_LA-1",
"ID": 1756398
"Sku": "AC_LP20",
"ID": 1756399
"@odata.nextLink": "https://api.channeladvisor.com/v1/Products?$select=Sku,ID&access_token=-Il9zeWYhA1JG9oY_KWq1I1_3dcJGh5EtcxtBClKa7w-34167&$skip=100"


  • You are unable to get the value of @odata.nextLink because the period indicates that SRP_JSON should get the nextLink property of the @odata object but in your JSON @odata.nextLink points to a property that contains a period in the name. In order to access the value you must escape the period in the property name by doubling the period.

    Try accessing it with SRP_Json(objResponse, "GETVALUE", "@odata..nextLink")

    The special characters that may need to be escaped in a property name are:

    If you ever need to access the value who has a property name with one of those characters you'll need to double the character in the path when trying to use SRP_JSON.
  • Thanks, Jared. I updated the documentation to emphasize this point.
  • That works fine. Thanks Jared.
Sign In or Register to comment.