Hello,
We’re currently working on the C# Crowdin API’s AddTag and we faced this issue:
Unexpected character encountered while parsing value: {. Path 'errors[0].message', line 6, position 18.
I downgraded the version to 2.12, same error happen. On this version, sendPostRequest is accessible so was easier to debug it.
string subUrl = FormUrl_ScreenshotTags(projectId, screenshotId);
CrowdinApiResult crowdinApiResult = await _client.SendPostRequest(subUrl, requests);
_jsonParser.ParseResponseObject<Tag[]>(crowdinApiResult.JsonObject);
crowdinApiResult is well responding with a property JsonObject. But it’s fail on _jsonParser.ParseResponseObject, since JsonObject data is an array and ParseResponseObject expect an object.
Here is the exact error on it:
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Crowdin.Api.Screenshots.Tag' 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.
By inspecting the GitHub - crowdin/crowdin-api-client-dotnet: .NET client library for Crowdin API code, we can see that there is no test for the AddTag. Is that even normal?
This issue look like this one C# API Client 2.14.0: StringBatchOperations fires a System.NullReferenceException as i think there is definitly something wrong with ParseResponseObject that is used at several places.
Thanks for your time on this!