Mapping JSON to objects and vice versa
In order to consume data in JSON format inside .Net programs, the natural approach that comes to mind is to use JSON text to populate a new instance of a particular class; either a custom one, built to match the structure of the input JSON text, or a more general one which acts as a dictionary.
Conversely, in order to build new JSON strings from data stored in objects, a simple export–like operation sounds like a good idea.
For this purpose, LitJSON includes the JsonMapper
class,
which provides two main methods used to do JSON–to–object and
object–to–JSON conversions. These methods are
JsonMapper.ToObject
and JsonMapper.ToJson
.