wwJsonSerializer::PropertyNameOverrides

Comma delimited list of property names that you like to override on the object to be serialized. Used to force property names into proper case rather than the default lower case only representation.

By default the serializer produces all JSON property names as lower case. This option allows you to override this behavior by specifying each property name with formatted casing of your choice.

Applies to objects and cursors. Note that this lookup adds some performance overhead to the parsing so use only if necessary. Specific scenarios include serving data for specific APIs that require a certain format for properties.

o.PropertyNameOverrides

Example

do wwJsonSerializer

loObject = CREATEOBJECT("Empty")
ADDPROPERTY(loObject,"Name","Rick")
ADDPROPERTY(loObject,"Company","West Wind")
ADDPROPERTY(loObject,"Entered",DATETIME())

loSer = CREATEOBJECT("wwJsonSerializer")

*** Produces: {"company":"West Wind","entered":"2012-02-27T23:31:49Z","name":"Rick"}
*** Properties are always rendered lower case
? loSer.Serialize(loObject)

*** Make sure these properties render in proper case
loSer.PropertyNameOverrides = "Name,Company,Entered"

*** Produces: {"Company":"West Wind","Entered":"2012-02-27T23:31:49Z","Name":"Rick"}
*** specified properties are overridden
? loSer.Serialize(loObject)

See also:

Class wwJsonSerialize

© West Wind Technologies, 1996-2018 • Updated: 10/09/17
Comment or report problem with topic