Solved

Creating JSON file in Universal Windows Application

Posted on 2016-09-04
4
50 Views
Last Modified: 2016-09-08
Hello,

Below is my code for creating a new JSON file in C#.. It gives an error "Object reference not set to an instance of an object.".. What is going wrong?
________________________________________________________________________________________________
Content.data.Add(de);            

string outputJSON = JsonConvert.SerializeObject(Content); //outputJSON is working fine
csfilStorageFile = await csfldrStorFolder.CreateFileAsync(clsDeclarations.gsDataFileName, Windows.Storage.CreationCollisionOption.ReplaceExisting); //The error is caught here

await FileIO.WriteTextAsync(csfilStorageFile , outputJSON);
________________________________________________________________________________________________

Regards.
0
Comment
Question by:Soumen Roy
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
louisfr earned 500 total points
ID: 41786461
Maybe csfldrStorFolder or clsDeclarations is null.
0
 

Author Comment

by:Soumen Roy
ID: 41787306
No, csfldrStorFolder has been created previous to this, the folder is being created. And clsDeclarations holds names for various strings, it exists too. :(
0
 
LVL 11

Expert Comment

by:louisfr
ID: 41787421
The StackTrace indicates that line as the source of the exception?
0
 

Assisted Solution

by:Soumen Roy
Soumen Roy earned 0 total points
ID: 41789034
Yes, right on the line I marked as error is caught here.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

We will take a look at the d3.js library for visualizations.  I will provide a walkthrough of a short bar graph example as well as introduce you to the d3.js API.  We also will explore links of other examples and further information regarding SVG's.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now