Chapter 13 SML# feature: dynamic types and typed manipulation of JSON
In network communication or file I/O, data are serialized to a character string in a specified format. For example, JSON is one of the most popular data serialization format in the Internet. Unlike ML data, serialized data are inherently untyped and heterogeneous. Therefore, to deal with serialized data in ML, untyped programming is needed even if the serialized data have a structure similar to some data structure in ML, such as a record. SML#’s dynamic typing mechanism allows the users to convert between dynamically-structured data including serialized data and statically-typed values. On top of this, SML# provides a type-safe way to manipulate JSON data; it gives the structures of JSON data static types like ML records and provides statically-typed constructs for JSON manipulation. This chapter describes these features.