Solved

Creating JSON file in Universal Windows Application

Posted on 2016-09-04
4
79 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

623 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