Cannot deserialize the current JSON array #136

Closed
opened 2024-11-12 21:28:57 +00:00 by knylbyte · 2 comments
knylbyte commented 2024-11-12 21:28:57 +00:00 (Migrated from github.com)

All data can't be displayed because this plugin can't handle the JSON array of objects. I'm running this plugin behind an iptx-proxy docker container but get the same data without this proxy.
Let me know if you need some more information for debugging this error.

[21:59:58] [ERR] [19] Jellyfin.Xtream.CatchupChannel: Failed to get channel items
Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Jellyfin.Xtream.Client.Models.EpgListings' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at Jellyfin.Xtream.Client.XtreamClient.QueryApi[T](ConnectionInfo connectionInfo, String urlPath, CancellationToken cancellationToken)
at Jellyfin.Xtream.CatchupChannel.GetStreams(Int32 categoryId, Int32 channelId, CancellationToken cancellationToken)
at Jellyfin.Xtream.CatchupChannel.GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)

I did a manual request with curl and get the following output from the request: get_livestream1268.txt

All data can't be displayed because this plugin can't handle the JSON array of objects. I'm running this plugin behind an iptx-proxy docker container but get the same data without this proxy. Let me know if you need some more information for debugging this error. > [21:59:58] [ERR] [19] Jellyfin.Xtream.CatchupChannel: Failed to get channel items > Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Jellyfin.Xtream.Client.Models.EpgListings' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. > To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. > Path '', line 1, position 1. > at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract) > at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) > at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) > at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) > at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) > at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) > at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) > at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) > at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) > at Jellyfin.Xtream.Client.XtreamClient.QueryApi[T](ConnectionInfo connectionInfo, String urlPath, CancellationToken cancellationToken) > at Jellyfin.Xtream.CatchupChannel.GetStreams(Int32 categoryId, Int32 channelId, CancellationToken cancellationToken) > at Jellyfin.Xtream.CatchupChannel.GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken) I did a manual request with curl and get the following output from the request: [get_livestream1268.txt](https://github.com/user-attachments/files/17722977/get_livestream1268_extended.txt)
Kevinjil commented 2024-11-13 09:25:51 +00:00 (Migrated from github.com)

Even though the provided API format makes more sense, I simply have no time to support alternative implementations which deviate from the published specification.

Even though the provided API format makes more sense, I simply have no time to support alternative implementations which deviate from the published specification.
knylbyte commented 2024-11-13 12:55:08 +00:00 (Migrated from github.com)

Even though the provided API format makes more sense, I simply have no time to support alternative implementations which deviate from the published specification.

Ok maybe then I will do my best to fix this by myselfe and if it works make an pull request. For now, it would be nice if you could send me an excerpt from your provider's query?
e.g.:
curl -X GET “http://xtreamcode.ex/player_api.php?username=id&password=pass&action=get_live_streams&category_id=25”

> Even though the provided API format makes more sense, I simply have no time to support alternative implementations which deviate from the published specification. Ok maybe then I will do my best to fix this by myselfe and if it works make an pull request. For now, it would be nice if you could send me an excerpt from your provider's query? e.g.: curl -X GET “http://xtreamcode.ex/player_api.php?username=id&password=pass&action=get_live_streams&category_id=25”
Sign in to join this conversation.
No Label wontfix
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Sirherobrine23/Jellyfin_Xtream#136
No description provided.