90 and 100 lines for serializers is quite the achievement.
At the moment I have a serializer (<glvn> to json string) and a deserializer (json string to <glvn>) of 40-60 lines of pure M COS code. Should run on any Caché version, was tested on 2012.2 and higher. Some proof that they really exist:
USER>d $system.CPU.Dump()
-- CPU Info for node maslov --------------------------------------------------
Architecture: x86
Model: Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz
< ... >
USER>d j2gSmall^zmawr
JSON2G^Wmgr Cache for Windows (x86-64) 2017.1
total time = 1.05795 avg time = .0000105795
G2JSON^Wmgr Cache for Windows (x86-64) 2017.1
total time = 1.898275 avg time = .00001898275
sJson <=> arr()? yes ; the result of conversion reversibility check
USER>zw sJson
sJson="{""BirthDate"":""1970-03-25"",""FirstName"":""Sean"",""Hobbies"":[""Photography"",""Walking"",""Football""],""LastName"":""Connelly""}"
USER>zw arr
arr("BirthDate")="1970-03-25"
arr("FirstName")="Sean"
arr("Hobbies",0)="Photography"
arr("Hobbies",1)="Walking"
arr("Hobbies",2)="Football"
arr("LastName")="Connelly"This code is not my own development (while I contributed a bit), so if anybody wants it to be published I should redirect this request to main contributor(s).
BTW: Sean, was this JSON string
TestRawJson = "{""TestAllAsciiChars"":"" !\""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]"_$c(142,143,144,145,146,147,148,149,150,151,152,153,154,157,158,159)_"...from your sample wrong escaped deliberately?
- Log in to post comments