SDK Objects: JSON serialization and deserialization

Support is currently being added to objects defined within the SDK to assist in the serialization and deserialization (marshalling and unmarshalling) from JavaScript Object Notation (JSON). This is being done by adding the required attributes to object class/struct member(s) and  properties defined by the Microsoft library System.Text.Json. Microsoft describe this library as “Provides high-performance and low-allocating types that serialize objects to JavaScript Object Notation (JSON) text and deserialize JSON text to objects, with UTF-8 support built-in. Also provides types to read and write JSON text encoded as UTF-8, and to create an in-memory document object model (DOM), that is read-only, for random access of the JSON elements within a structured view of the data.”

This feature will allow developers to serialize and deserialize objects with the FPAssistant Suite SDK to JSON giving the ability to create parameter files, interact with web API’s and other software development design patterns.

The implementation makes sure that only the minimum data is serialize to JSON to deserialize back, in the case of the GeoCoordinate object this is simply a decimal latitude and longitude seen below (ARP) in a sample screen shot of a JSON file opened in Visual Studio Code.

Example of object data held in JSON

Below is code taken from the internal Unit Test code that checks the JSON serialization and deserialization process is working correctly for the GeoCoordinate object.

Testing JSON

 

 

 

 

 

2020-12-08T16:11:19+00:00December 8th, 2020|FPAssistant SDK/API News, General News|