I needed a few random things, so I added them-- don't know if you're interested.
There was no way to just serialize a C# object, so I added that capability as a JsonObject constructor, i.e.:
var value = new MyObject();
var json = new JsonObject(value).ToString();
There were no tests, so I added some basic ones that test all supported primitives (not double or long as they are not strictly supported in JS I don't believe), composite classes, and arrays.
Added JsonIgnoreAttribute which makes JsonObject ignore a specific field:
[JsonIgnore]
public int Foo;
The field "Foo" will be ignored in JsonObject.
Added JsonNameAttribute which allows changing the name of a field in json:
public class Foo
{
[JsonName("fizz")]
public int Bar;
}
Hi there,
I needed a few random things, so I added them-- don't know if you're interested.
JsonObject
constructor, i.e.:There were no tests, so I added some basic ones that test all supported primitives (not
double
orlong
as they are not strictly supported in JS I don't believe), composite classes, and arrays.Added
JsonIgnoreAttribute
which makesJsonObject
ignore a specific field:The field "Foo" will be ignored in
JsonObject
.JsonNameAttribute
which allows changing the name of a field in json:Outputs to roughly
{ "fizz" : 3 }
for example.