| Einhugur JSON III Serialization Framework for Xojo |
|
JSONSerializerIII.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()
JSONSerializationIII.JSONSerializerIII.DeSerializeFromString(root,"",TextArea1.Text)
MessageBox root.Message
MessageBox root.data.items(0).id
MessageBox root.data.items(1).id
var s2 as String = JSONSerializationIII.JSONSerializerIII.SerializeToString(root, "")
MessageBox "Serialised again:" + EndOfLine + EndOfLine + s2
catch ex as JSONSerializationIII.SerializationException
MessageBox ex.Message
end try
This method can throw SerializationException.
See Also
JSONSerializerIII Class