I think FileWriter is a class in Java not in Asp.net. You can use StreamWriter instead.
Something similar to this..
using (StreamWriter _testData = new StreamWriter(Server.MapPath("~/data.txt"), true))
{
_testData.WriteLine(obj);
}
Edited: Removed ToJSONString().