| Einhugur JSON II Serialization Framework for Xojo |
|
JSONSerializerII.SerializeToString Method
Shared convenience method to do one line serialization.
shared SerializeToString(
item
as Object,
rootName
as String)
as String
Parameters
- item
- The item to be serialized
- rootName
- Name of the root. This can be empty string if package root is not named.
Returns
- String
- The serialised result as JSON string.
Remarks
try
var root as new ItemPackage()
JSONSerializationII.JSONSerializerII.DeSerializeFromString(root,"",TextArea1.Text)
MessageBox root.Message
MessageBox root.data.items(0).id
MessageBox root.data.items(1).id
var s2 as String = JSONSerializationII.JSONSerializerII.SerializeToString(root, "")
MessageBox "Serialised again:" + EndOfLine + EndOfLine + s2
catch ex as JSONSerializationII.SerializationException
MessageBox ex.Message
end try
This method can throw SerializationException.
See Also
JSONSerializerII Class