web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Inbound JSON Serialization Error

(0) ShareShare
ReportReport
Posted on by

I'm trying to consume an inbound JSON file I've also tried with code that duplicates it here.  The client crashes at the JsonTextReader statement and throws the following error:   

Type: System.Runtime.Serialization.SerializationException
Message: <ii>Type 'System.IO.StringReader' with data contract name 'StringReader:schemas.datacontract.org/.../System.IO' is not expected. Consider using a DataContractResolver if you are using DataContractSerializer or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to the serializer.</ii>

ReadString := '{';
ReadString :=  ReadString.ToString + '"odata.metadata": "nav2018/.../OData$metadata#ScionCostComponents",';
ReadString :=  ReadString.ToString + '"value": [';
ReadString :=  ReadString.ToString + '{';
ReadString :=  ReadString.ToString + '"Code": "TEST",';
ReadString :=  ReadString.ToString + '"Descripiton": "Test1",';
ReadString :=  ReadString.ToString + '"Cost_Account_No": "",';
ReadString :=  ReadString.ToString + '"Cost_Account_Balance": "0",';
ReadString :=  ReadString.ToString + '"Applied_Account_No": "14200",';
ReadString :=  ReadString.ToString + '"Applied_Account_Balance": "0",';
ReadString :=  ReadString.ToString + '"Date_Filter": "0001-01-01T00:00:00"';
ReadString :=  ReadString.ToString + '}';
ReadString :=  ReadString.ToString + ']';
ReadString :=  ReadString.ToString + '}';

String := JsonConvert.SerializeObject(ReadString);
StringReader := StringReader.StringReader(String);
JsonTextReader := JsonTextReader.JsonTextReader(StringReader);

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans