Code Monkey home page Code Monkey logo

Comments (6)

mx2rel avatar mx2rel commented on September 26, 2024

This issue seems to be happening to multiple developers, including myself, and has been discussed previously in #925, #926 and #928. For me, it randomly stopped happening after few days.

from spotifyapi-net.

Inzaniity avatar Inzaniity commented on September 26, 2024

This issue seems to be happening to multiple developers, including myself, and has been discussed previously in #925, #926 and #928. For me, it randomly stopped happening after few days.

I'm aware that this was discussed. I raised the issue out of #925 to further spread awareness for it.

The Newtonsoft.JSON Deserializer should convert int to double if int is returned from the API and double is expected. Thats why the approach of changing the types might work long term.

from spotifyapi-net.

Inzaniity avatar Inzaniity commented on September 26, 2024

Well I should read all the discussions beforehand. It seems the Serializer has been modified to convert.

My bad!

from spotifyapi-net.

lwhuybrechts avatar lwhuybrechts commented on September 26, 2024

Hi @Inzaniity,
I'm also experiencing the JsonReaderException on some properties, for instance album.total_tracks. Updating to the latest SpotifyAPI.Web (7.1.1) did not fix them all.

If I add the DoubleToIntConverter attribute to the properties that still cause the exceptions it's ok again.

So it seems to me we should add the DoubleToIntConverter attribute to all int properties so it doesn't break when Spotify decides to return doubles/floats somewhere. What do you think?

from spotifyapi-net.

Inzaniity avatar Inzaniity commented on September 26, 2024

Hi @Inzaniity, I'm also experiencing the JsonReaderException on some properties, for instance album.total_tracks. Updating to the latest SpotifyAPI.Web (7.1.1) did not fix them all.

If I add the DoubleToIntConverter attribute to the properties that still cause the exceptions it's ok again.

So it seems to me we should add the DoubleToIntConverter attribute to all int properties so it doesn't break when Spotify decides to return doubles/floats somewhere. What do you think?

I mean that is what I did but on an older code base. So yeah, converting all expected ints seems to be the solution here.

from spotifyapi-net.

Inzaniity avatar Inzaniity commented on September 26, 2024

A Spotify developer confirmed a fix for this in the discussion on the Spotify developer forum

An optimization in the deserialization of JSON in upstream was causing the serializer to default to double types for integer values. The optimization was not applied to all queries, and several tools were sanitizing the response which was the reason we did not uncover this from the start.

from spotifyapi-net.

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.