cancel
Showing results for 
Search instead for 
Did you mean: 

JSON String is order dependent

My code mixes up the orders of the key/value pairs. There is no way to ressolve this that I'm aware of with the language I'm required to use. This is what it generates:

 

{
"authenticateTestRequest": {
"merchantAuthentication": {
"transactionKey": "TRANSCATION_KEY",
"name": "API_LOGIN_ID"
}
}
}

 

I get the following error:

 

{
"messages": {
"resultCode": "Error",
"message": [
{
"code": "E00003",
"text": "The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'name' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'mobileDeviceId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."
}
]
}
}

 

This shouldn't fail cause it's still a valid JSON string. Is there any way to have the API ignore the order?

tylerzika
Member
1 REPLY 1

Hi tylerzika,

 

Thanks for reporting this issue.

Our  current JSON request and response format is not a RESTful implementation, instead it's a conversion from XML to JSON. In order to get a successful response, API requires elements to be passed in the defined order.

 

However, We DO have  REST APIs in development that should solve the issue.

 

Also, for the time being you can refer to below link and see if the mentioned work arounds can be applied in the language you are using for developement.

 

https://community.developer.authorize.net/t5/Integration-and-Testing/JSON-API-warning-properties-are...

 

Please let us know if you need more details.

 

Thanks,

Richa

RichaSingh
Authorize.Net Developer Authorize.Net Developer
Authorize.Net Developer