Now I need to send both a single custom C# object, but also an array of them. I really need an example or some documentation to see how this is done. I don't mind writing the serialization/de-serialization if need be, but I also don't see how to do that.
If you want to be able to export types without writing any import/export code then your type must meet the following conditions:
· The type is public
· The type is not a primitive type
· The type has an default constructor (one that takes no arguments)
· The type has one or more read/write properties
· The type is an anonymous class (C# 3)
Array support is automatically available in Jayrock. If you’re type does not meet the above criteria, then you’ll need to provide an exporter and/or importer for the type. If you need help with understanding those them let me know and I’ll expand further.
You also several attributes available to control export of type members:
· JsonExportAttribue – Apply to mark a read-only property as exportable.
· JsonIgnoreAttribute – Apply to prevent a read/write property from being exported.
· JsonMemberNameAttribute – Apply to provide an alternate name for an object member (default is “camelCase”).
· JsonMemberNamingConventionAttribute – Apply to change the default naming convention for a member name.
Jayrock also comes with several samples and you’ll find some advanced conversion examples in JsonConversionsDemo:
Hope this helps so far.
- Atif