Smalltalk/X WebserverDocumentation of class 'JSONTypeEncoder': |
|
|
Class: JSONTypeEncoderInheritance:Object | +--JSONTypeEncoder | +--JSONTypeEncoder::NullTypeEncoder | +--JSONTypeEncoder::STXTypeEncoder | +--JSONTypeEncoder::STXTypeEncoder2
Description:<<END Instances of (subclasses of me) encode type encodings by wrapping stored values into some json composite object, or adding additional type-info slots. A NullTypeEncoder generates standard JSON (no type info) [exBegin] |o o0 o1 o2 s0 s1 s2 o1b o2b| o1 := Rectangle origin:(10@20) corner:(100@200). s0 := (JSONPrinter new typeInfoFormat:nil) encode:o1. "/ -> '{"left":10,"top":20,"width":90,"height":180}' . s1 := (JSONPrinter new typeInfoFormat:#stx) encode:o1. "/ -> '{"@__type__":"Rectangle","@__value__":{"left":10,"top":20,"width":90,"height":180}}' . s2 := (JSONPrinter new typeInfoFormat:#stx2) encode:o1. "/ -> '{"@__type__":"Rectangle","left":10,"top":20,"width":90,"height":180}' . o0 := JSONReader fromJSON:s0. "/ -> OrderedDictionary('left'->10 'top'->20 'width'->90 'height'->180) o1 := JSONReader fromJSON:s1. "/ -> OrderedDictionary('@__type__'->'Rectangle' '@__value__'->OrderedDictionary('left'->10 'top'->20 'width'->90 'height'->180)) o2 := JSONReader fromJSON:s2. "/ -> OrderedDictionary('@__type__'->'Rectangle' 'left'->10 'top'->20 'width'->90 'height'->180) o1b := (JSONReader new typeInfoFormat:#stx) decode:s1. "/ -> (10@20) extent: (90@180) o2b := (JSONReader new typeInfoFormat:#stx2) decode:s2. "/ -> (10@20) extent: (90@180) [exEnd] END>> Class protocol:instance creation queries
Instance protocol:accessing protocol
Private classes:NullTypeEncoder STXTypeEncoder STXTypeEncoder2 |
|
ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 28 Mar 2024 17:14:03 GMT
|