Giter VIP home page Giter VIP logo

Comments (5)

lanlin avatar lanlin commented on August 19, 2024

I think itβ€˜s nothing about json_decode, but the data responded from Nylas was invalid JSON.

In Nylas's API docs, they said:
image

I have checked the content type from the response header, like this:
image

So, when it's not JSON, it will be returned directly without parsing.

And, "Unable to parse response body into JSON: 10" means that:
the "JSON_ERROR_UTF16" error occurs.

The reason is single unpaired UTF-16 surrogate in Unicode escape contained in the JSON string passed to json_encode().

I will add a new config option which can be used to control the exception throws when decoding the responded body.

After it enabled, the body content will be returned directly without parsing when the json_decode error occurs.

from nylas-php.

lanlin avatar lanlin commented on August 19, 2024

@robtesch try this https://github.com/lanlin/nylas-php/releases/tag/3.4.0

from nylas-php.

robtesch avatar robtesch commented on August 19, 2024

@lanlin awesome! Thank you! Will give it a go ASAP and let you know (probably only on Sunday).

from nylas-php.

robtesch avatar robtesch commented on August 19, 2024

@lanlin OK fantastic, I managed to use this config option to work around the issue of the invalid json response from nylas. Turns out it was only 1 message from 1 account that was causing the issue. I have now built a workaround where I simply request smaller and smaller batches of messages until I get only valid messages, then I increment the offset to skip the invalid message.

from nylas-php.

lanlin avatar lanlin commented on August 19, 2024

@robtesch That's good.

from nylas-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.