Hello,
recently my company has been using web services to decouple our very very old legacy system into more modern micro-services linked by API's. We have created a our own JSON parser to to tokenise the input JSON message string and map it to a corresponding data structure using the new DATA-INTO opcode. However we have been wondering about how to go the other way, serialize a data structure to a JSON string.
We looked at using YAJL initially but it was a manual process and each data structure had to be serialized manually - unless I have missed something obvious. With C# and JAVA there are built in reflection libraries that allow the programmer to determine the properties of a class/type and recursively check for any additional sub-classes/types all the way down to the primitive types. I might be barking mad but would there be anything in RPG that allows us to do the same? That way we could determine the type of data structure subfields and serialize them to the correct JSON type.
recently my company has been using web services to decouple our very very old legacy system into more modern micro-services linked by API's. We have created a our own JSON parser to to tokenise the input JSON message string and map it to a corresponding data structure using the new DATA-INTO opcode. However we have been wondering about how to go the other way, serialize a data structure to a JSON string.
We looked at using YAJL initially but it was a manual process and each data structure had to be serialized manually - unless I have missed something obvious. With C# and JAVA there are built in reflection libraries that allow the programmer to determine the properties of a class/type and recursively check for any additional sub-classes/types all the way down to the primitive types. I might be barking mad but would there be anything in RPG that allows us to do the same? That way we could determine the type of data structure subfields and serialize them to the correct JSON type.
Comment