Value2JSON
.jsftype
, the remaining properties specify how to
format the JSON entry. If FSCEXPEXT@1.1001:jssimple
is true, for object classes just the object
address is generated, otherwise the property list from FSCEXPEXT@1.100:jsfproperties
specifies
the properties of the sub entry. JSONPropertyFormat[] properties = [
{ jpfattrdef: #usersurname, jpfname: "FamilyName" },
{ jpfattrdef: #userfirstname, jpfname: "FirstName" }
];
JSONStructFormat[] simpleformat = [
{ jsftype: #User, jsfsimple: true }
];
JSONStructFormat[] complexformat = [
{ jsftype: #User, jsfproperties: properties }
];
User[] users = FROM User u WHERE u.userlogname like '%0001%';
User[] twousers = [users[0], users[1]];
dictionary data;
data.users = twousers;
string standardJSON = cooobj.Value2JSON(twousers);
string simpleJSON = cooobj.Value2JSON(twousers, , , simpleformat);
string complexSON = cooobj.Value2JSON(twousers, , , complexformat);
string dataJSON = cooobj.Value2JSON(data, , , complexformat);
result in the following JSON strings
standardJSON = [
{"objaddress":"COO.1.506.1.1000074","objname":"Baumann0001 Christina"},
{"objaddress":"COO.1.506.1.1000077","objname":"Owner0001 Michael"}
]
simpleJSON = [
{"objaddress":"COO.1.506.1.1000074"},
{"objaddress":"COO.1.506.1.1000077"}
]
complexJSON = [
{"FamilyName":"Baumann0001", "FirstName":"Christina"},
{"FamilyName":"Owner0001","FirstName":"Michael"}
]
dataJSON = {
"users": [
{"Family Name":"Baumann0001","First Name":"Christina"},
{"Family Name":"Owner0001","First Name":"Michael"}
]
}
Type |
Property |
Name |
Element Formats |
||
Simple Format |
||
Object Class or Type |
Element Formats (FSCEXPEXT@1.1001:jsfproperties)
JSONPropertyFormat[] FSCEXPEXT@1.1001:jsfproperties
Simple Format (FSCEXPEXT@1.1001:jsfsimple)
boolean FSCEXPEXT@1.1001:jsfsimple
Object Class or Type (FSCEXPEXT@1.1001:jsftype)
ComponentObject FSCEXPEXT@1.1001:jsftype not null
Additional Information