Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating JSON file in Universal Windows Application

Posted on 2016-09-04
4
Medium Priority
?
94 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 1500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

916 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