Reputation: 91
I've started using FastJSON and I'm having some problems for use it. I can't find any guide or documentation in internet, only a little extract in CodeProject.
For example: I've got this class:
[Serializable]
public class Prueba
{
public Prueba()
{
prueba1 = 5;
prueba2 = 6;
prueba3 = "Hola";
}
public int prueba1 { get; set; }
public int prueba2 { get; set; }
public string prueba3 { get; set; }
}
If I execute fastJSON.JSON.ToJSON(new Prueba())
i am getting this string:
{"$types":{"WebApplication3.Prueba, WebApplication3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null":"1"},"$type":"1","prueba1":5,"prueba2":6,"prueba3":"Hola"}
But I was expecting this string:
"{"prueba1":5,"prueba2":6,"prueba3":"Hola"}"
As you can see, it is including some assembly information that I don't want in the string. I have tried playing with JSONParameters class, but I don't see any property for this situation.
So... Do you know how configure this?? Do you know any guide or documentation on internet to understand well how fastJSON works??
Thanks a lot, Regards
Upvotes: 2
Views: 3087
Reputation: 38529
Try setting UseSerializerExtension
to false:
Something like:
fastJSON.JSON.Instance.UseSerializerExtension = false;
fastJSON.JSON.ToJSON(new Prueba());
EDIT
It appears the API has changed. You now need to pass an instance of JSONParameters
Like this
fastJSON.JSON.ToJSON(new Prueba(), new JSONParameters(){UseExtensions = false});
Upvotes: 9