Re: Invalid JSON format

Solved! Go to solution

Invalid JSON format

Hello,

 

I would appreciate some help

I'm testing the Card-On-File Data Service API.

I have already configured the Two way SSL communication and Message Level Encryption.

The API Reference URL is: https://developer.visa.com/capabilities/card-on-file-data-inquiry/reference#tag/Card-On-File-Data-Se...

 

URL: [POST] https://sandbox.api.visa.com/cofds-web/v1/datainfo

Headers:

keyId: ***************

Accept: application/json

Content-Type: application/json

 

My Request is:

 

{
    "encData": "eyJjdHkiOiJhcHBsaWNhdGlvblwvanNvbjtjaGFyc2V0PVVURi04IiwiZW5jIjoiQTEyOEdDTSIsImlhdCI6MTY4OTE4NDYxNjIxMCwiYWxnIjoiUlNBLU9BRVAtMjU2In0.SKFCPPIewFsO6E9pMlqxiB4bdeiw0sBvnuLoG0bUBhraqC8EZadz1jaNcxjoUEBY-WPpCoEodwJXJykqNVv3hiCcBf9cdRbz_LPSUzKMv0WERKlNHhTizsmzK5UR6GBD3qImng5b--NNf64iJkcRwDy23agypmBBZ49HH5e1Y0TBVcX0uHznwVXQByck1HrKPzFw8OV2YPgyVar2j8uo9QRJvjvScb23qcAnSgm0WjxFL2n0m8r8nuCujkRcjEpMSxN1TWidl4FcsGjxoVxkrlfFZUBUmkGIy_-LwJ8BKCUCk4N5fb84dBW3vU7AeZZZIpJjbtEfbWBNVpixc3P9-A.ckJFA0XvHf-42Rn6.SDUmrZMHuroIVmlXfRUPQGhFGTDcGSgkILiX5Rl1-iwREgW3-QBMowyL7XWc_Fankze1.Xbyi45jaOgXPLOclPgP6aw"
}

 

Which decrypted is:

 

{
    "requestHeader": {
        "requestMessageId": "6da61e1b8b024532a2e2eacb1afz858132a2e0eacb1af58581",
        "messageDateTime": "2023-07-12 05:25:12.327"
    },
    "requestData": {
        "pANs": [
            4406982013274163
        ],
        "group": "STANDARD"
    }
}

 

Response encrypted:

 

{
    "encData": "eyJjdHkiOiJhcHBsaWNhdGlvblwvanNvbjtjaGFyc2V0PVVURi04IiwiZW5jIjoiQTEyOEdDTSIsImlhdCI6MTY4OTE4NDA4MTc2OSwiYWxnIjoiUlNBLU9BRVAtMjU2In0.m2PrN3FiHXvLhDs5SV1ER_3wSQJc7erlyZCxtLZV6gsn2OgzgMCpCEyZCNklTYmaY8nERvPMQuo5OXlIUTRc7GNQgobo66fJXryMJ4QqTgQrGdNYS7qdbPJiB1G6nYDSVWce49e_S_BkGCQ0wPEBzxWE8E1P5c-drs8pQ9_HLUOlsHx4viVP8wxLNQ-hXcBv8nCEHPJPYnv-FYLH4A-kYzvEX8itaMGv6gTB0ySo1KepZn-cw2crkrO-h6tzi3929q-hgGlt9rrde_5KLNSk0eOB3DdpmEDbJ0O_cxOYlvPoYdRZZn7kJ5P4qxRyVPWyYocFOZOyk-0TiZHyO6_GeQ.C75PVox_vClxRDr9.8emwJqRkulUW1w-8OMRQrVN1lCT7_AahWTsE1na8l5zE2IyT-0foAVi_LnQNltDJYy99.PXj_ASIaILGYgOyVI9YQwA"
}

 

Which decrypted is:

 

{status=400, errorMessage=Invalid JSON format
}

 

I didn't found any documentation of that error, and i think the JSON format is valid. I'm using the same request shown in the Api documentation

 

Thanks!

2 REPLIES 2

Re: Invalid JSON format

Solved!

 

The problem was in the encrypted data. My code was encrypting like 

requestHeader={
        requestMessageId="6da61e1b8b024532a2e2eacb1afz858132a2e0eacb1af58581",
        messageDateTime="2023-07-12 05:25:12.327"
    }....

instead of :

"requestHeader": {
        "requestMessageId": "6da61e1b8b024532a2e2eacb1afz858132a2e0eacb1af58581",
        "messageDateTime": "2023-07-12 05:25:12.327"
    }.....

thanksl!

API_Managers
Visa Developer Support Specialist

Re: Invalid JSON format

Hi @matiasgscotia,

 

Thanks for sharing your your solution with us! We really appreciate this 😀




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.