#XPRIM_Json: Create simple Json

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

#XPRIM_Json: Create simple Json

Post by René Houba »

Because there is no online #XPRIM_Json documentation available yet, I like to introduce some examples here. I hope that based on my examples, that others will follow and share their examples here as well.

This example creates a very simple Json.

* Simple example:
Define_Com Class(#XPRIM_Json) Name(#json)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonObj) Reference(*DYNAMIC)

#jsonObj <= #json.CreateRootObject

#jsonObj.InsertObject Key('name')
#jsonObj.InsertString Key("givenname") String('Sofie')
#jsonObj.InsertString Key("lastname") String("Johnsen")
#jsonObj.InsertNumber Key('age') Number(24)

#jsonObj.SerializeToFile Path('C:\TEMP\JsonExampleSimple.json')


Result:
Simple Jsaon example.PNG
Simple Jsaon example.PNG (4.44 KiB) Viewed 41413 times
Post Reply