Solved

Creating JSON file in Universal Windows Application

Posted on 2016-09-04
4
72 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmakerā€¦
This video teaches users how to migrate an existing Wordpress website to a new domain.

752 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