Deserializes JSON into a .NET object or simple value.
o.FromJson(lcJson,lvDotnetType)
Parameters
lcJson
JSON string.
lvDotnetType
The type of the object to be deserialized into. Accepts a .NET Type object (use GetType or GetTypeFromName) or a fully qualified class name (Namespace.Class).
Remarks
Depends on NewtonSoft.Json.dll library present in addition to wwdotnetbridge.dll
Works only in the commercial versions of wwDotnetBridge (West Wind tools)
Example
loCust = loBridge.CreateInstance("Westwind.WebConnection.TestCustomer")
loCust.Name = "Rick"
loCust.Company = "Westwind"
loCust.Number = 100.21
loCust.Entered = DATETIME()
loCust.Address.Street = "32 Kaiea"
loCust.Address.City = "Paia"
*** Serialize to JSON string
lcJson = loBridge.ToJson(loCust,.t.)
? lcJson
*** Deserialize into a new object entirely
loCust2 = loBridge.FromJson(lcJson,"Westwind.WebConnection.TestCustomer")
? loCust2.Company
? loCust2.Address.City
See also:
Class wwDotNetBridge | wwDotNetBridge::ToJson | wwDotNetBridge::FromXml | wwDotNetBridge::ToXml© West Wind Technologies, 1996-2024 • Updated: 10/02/24
Comment or report problem with topic