Why is Jason.decode! returning converted error?

I am not understanding why Jason.decode!(json_string) is returning converted error

"{\"calendar\":{\"accessRole\":\"owner\",\"backgroundColor\":\"#9a9cff\",\"colorId\":\"17\",\"conferenceProperties\":{\"allowedConferenceSolutionTypes\":[\"hangoutsMeet\"]},\"defaultReminders\":[{\"method\":\"popup\",\"minutes\":30}],\"deleted\":null,\"description\":null,\"etag\":\"\\\"1602100079130000\\\"\",\"foregroundColor\":\"#000000\",\"hidden\":null,\"id\":\"fakeemail07@gmail.com\",\"kind\":\"calendar#calendarListEntry\",\"location\":null,\"notificationSettings\":{\"notifications\":[{\"method\":\"email\",\"type\":\"eventCreation\"},{\"method\":\"email\",\"type\":\"eventChange\"},{\"method\":\"email\",\"type\":\"eventCancellation\"},{\"method\":\"email\",\"type\":\"eventResponse\"}]},\"primary\":true,\"selected\":null,\"summary\":\"fakeemail07@gmail.com\",\"summaryOverride\":null,\"timeZone\":\"America/Toronto\"},\"businessName\":\"Fake Systems\",\"streetAddress\":\"1700 Islington Ave\",\"provinceStates\":\"Ontario\",\"ZIPcodePostalCode\":\"M9B 3K9\",\"phone_number\":\"2222222222\",\"country\":\"ca\",\"appointmentName\":\"fssdf\",\"durationInMinute\":\"3434\",\"price\":\"900\",\"serviceLocation\":\"atBusiness\",\"depositType\":\"None\"}"

This is is the original json_string:

“{“calendar”:{“accessRole”:“owner”,“backgroundColor”:”#9a9cff",“colorId”:“17”,“conferenceProperties”:{“allowedConferenceSolutionTypes”:[“hangoutsMeet”]},“defaultReminders”:[{“method”:“popup”,“minutes”:30}],“deleted”:null,“description”:null,“etag”:"\“1602100079130000\”",“foregroundColor”:"#000000",“hidden”:null,“id”:"fakeemail@gmail.com",“kind”:“calendar#calendarListEntry”,“location”:null,“notificationSettings”:{“notifications”:[{“method”:“email”,“type”:“eventCreation”},{“method”:“email”,“type”:“eventChange”},{“method”:“email”,“type”:“eventCancellation”},{“method”:“email”,“type”:“eventResponse”}]},“primary":true,“selected”:null,“summary”:"fakeemail07@gmail.com”,“summaryOverride”:null,“timeZone”:“America/Toronto”},“businessName”:“Fake Systems”,“streetAddress”:“1700 Islington Ave”,“provinceStates”:“Ontario”,“ZIPcodePostalCode”:“M9B 3K9”,“phone_number”:“2222222222”,“country”:“ca”,“appointmentName”:“fssdf”,“durationInMinute”:“3434”,“price”:“900”,“serviceLocation”:“atBusiness”,“depositType”:“None”}"

Your quation marks are not valid. Change them to ". Then it should work.

I can run Jason.decode! on the first JSON string though. Not sure why the second one is with the wrong quotes.

@Guelor what error are you getting exactly? The first JSON string parses just fine for me.

1 Like

Thanks for the response, I thought the error was with the Jason.decode! but the error happened in other levels of my application link to original question: I am not understanding why is Jason.decode! returning converted error {:with_clause, %{....}}?