I am getting a response from a Google book.
As it is, not changing anything:
16:34:04.1 (100890464)|USER_DEBUG|[15]|DEBUG|response: ProcessGBSBookInfo({"ISBN:0451526538":{"bib_key":"ISBN:0451526538","info_url":"https://books.google.com/books?id=7osYCoz_gdgC\u0026source=gbs_ViewAPI","preview_url":"https://books.google.com/books?id=7osYCoz_gdgC\u0026source=gbs_ViewAPI","thumbnail_url":"https://books.google.com/books/content?id=7osYCoz_gdgC\u0026printsec=frontcover\u0026img=1\u0026zoom=5","preview":"noview","embeddable":false,"can_download_pdf":false,"can_download_epub":false,"is_pdf_drm_enabled":false,"is_epub_drm_enabled":false}});
But when attempt to deserialize it as untyped, I'm receiving an error. This is how I'm trying to deserialize it:
Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
And this is the error I got:
16:34:04.1 (106368272)|FATAL_ERROR|System.JSONException: Unexpected character ('P' (code 80)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]
Seems the response is not valid as it is: ProcessGBSBookInfo({...}
Should I build a class to deserialize to that type? just interested in one of the fields in the response.
What am I missing here?
Thanks in advance