0

I am getting output via method as System.Web.Http.Results.JsonResult'1[CustomType]..How to convert this into a readable string? When I deserialize into a JSON object it's throwing me an error?

Is this a JSON object?

--Adding code

I am UnitTesting a method and that returns System.Web.Http.Results.JsonResult'1[CustomType]

Here the FakeDetails method is called within GetFakeDetails

 A.CallTo(() => FakeTestInterface.FakeDetails(A<string>.Ignored)).Returns((CustomTypeData));
var a = await  Test.GetFakeDetails(InputData);

The value of a is System.Web.Http.Results.JsonResult'1[CustomType]

Shan
  • 2,822
  • 9
  • 40
  • 61
  • Possible duplicate of [JSONResult to String](https://stackoverflow.com/questions/4571985/jsonresult-to-string) – Chandan Rauniyar Nov 18 '17 at 02:13
  • new JavaScriptSerializer().Serialize(jsonResult); I tried the same and it's throwing me A circular reference was detected while serializing a object of type – Shan Nov 18 '17 at 02:21
  • Ok can you please provide your code like what have you done so far? – Chandan Rauniyar Nov 18 '17 at 02:22
  • 1
    Added code to the question – Shan Nov 18 '17 at 02:43
  • 1
    What is the shape of your custom type. Also please have a look at https://stackoverflow.com/questions/1153385/a-circular-reference-was-detected-while-serializing-an-object-of-type-subsonic for circular reference error while serializing. – Chandan Rauniyar Nov 18 '17 at 02:58
  • 1
    You have a circular reference. You need to add your model code to the question. –  Nov 18 '17 at 03:12

0 Answers0