News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Parse Phone Number JSON error
Tags: sdk
Jun 25, 2019 at 4:58pm   •   3 replies  •  0 likes
nuMedia Receptionist

Calling the following code:

var rc = new RestClient("CPWD", "SECRET");

rc.Authorize("PWD", "EXT", "PASSWORD").Wait(60000);

var request = new

{

originalStrings = new[] { phoneNumber }

};

var res = rc.Restapi().NumberParser().Parse().Post(request);

res.Wait(60000);


This code works fine (with real application and user credentials) up until I get to the res.Wait(60000) call.

When I get here I get the following error:

Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'RingCentral.ParsePhoneNumber_CountryInfo[]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.

To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.

Path 'homeCountry.uri', line 4, position 11. Date: 6/25/2019 7:48:16 PM Trace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)

I would like to continue to use the SDK but if there is no way around this error then I can just do a raw REST call.

I am trying to upgrade a legacy application so I am using an older version of the RingCentral.Client SDK version 1.03.


Thanks!

1 Answer
answered on Jun 26, 2019 at 1:27pm  

Hi, I can confirm that it is a bug in the SDK and we are going to fix it as soon as we can.

Meanwhile, here is a workaround solution for this problem:

ParsePhoneNumberRequest request = new ParsePhoneNumberRequest();
request.originalStrings = new string[] { "+11234567890" };
var res = await rc.Post<string>("/restapi/v1.0/number-parser/parse", request);
Console.WriteLine(res); 

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us