Error #01: invalid character 'I' looking for beginning of value

59 views
Skip to first unread message

Greg Quinn

unread,
Feb 5, 2024, 10:35:27 PM2/5/24
to KrakenD Community
I am getting this error in the KrakenD container logs. 
I don't understand what the problem is, as my API function is definately returning valid JSON.

json_pretty.jpg

{ "_id" : "f6df6879-3212-4077-b92f-b2c79e118255", "name" : "Test Player", "storeId" : "Meltdown", "firstLoginDate" : ISODate("2024-02-06T03:25:29.541Z"), "lastLoginDate" : ISODate("2024-02-06T03:25:29.541Z"), "country" : "TODO", "city" : "TODO", "valueToDate" : 0, "inventory" : [{ "_id" : "tyres_common", "qty" : 1 }, { "_id" : "paint_common", "qty" : 1 }, { "_id" : "decal_common", "qty" : 1 }], "upgrades" : [{ "_id" : "engine", "tier" : 1, "lvl" : 1 }, { "_id" : "air_filter", "tier" : 1, "lvl" : 1 }, { "_id" : "brakes", "tier" : 1, "lvl" : 1 }, { "_id" : "aero_control", "tier" : 1, "lvl" : 1 }, { "_id" : "aero_profile", "tier" : 1, "lvl" : 1 }, { "_id" : "bumper", "tier" : 1, "lvl" : 1 }, { "_id" : "nitro_tank", "tier" : 1, "lvl" : 1 }, { "_id" : "nitro_recharge", "tier" : 1, "lvl" : 1 }, { "_id" : "reset_time", "tier" : 1, "lvl" : 1 }], "settings" : [{ "_id" : "engine_volume", "val" : 80 }, { "_id" : "sound_fx_volume", "val" : 80 }, { "_id" : "music_volume", "val" : 80 }, { "_id" : "gfx_quality", "val" : 1 }, { "_id" : "fps", "val" : 60 }, { "_id" : "send_rate", "val" : 60 }, { "_id" : "region", "val" : 1 }] }

As you can see this JSON is perfectly valid. 
I saw another post about this in the groups, but couldn't understand what exactly needs to be done with the input-headers config to make it accept JSON.

Thanks

David Hontecillas

unread,
Feb 6, 2024, 4:11:31 AM2/6/24
to KrakenD Community, gr...@meltdowninteractive.com
Is complaining about ISODate (it starts with an `I` and is not a valid JSON value .. just remove that kind of "function call" over there).

And your statement that "JSON is perfectly valid" is not true: go and paste your JSON in https://jsonlint.com/ , and you will find out the issue.

Reply all
Reply to author
Forward
0 new messages