#XPRIM_Json: Create simple Json
Posted: Thu Apr 21, 2022 5:07 pm
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:
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: