bond-0.4.0.1: Bond schema compiler and code generator

Copyright(c) Microsoft
LicenseMIT
Maintaineradamsap@microsoft.com
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Language.Bond.Syntax.JSON

Contents

Description

 

Synopsis

FromJSON and ToJSON instances

This module defines FromJSON and ToJSON instances for Bond abstract syntax tree. They allow using the aeson library to encode Bond AST types to JSON format:

> encode (Bond [] [Namespace Nothing ["example"]] [])
"{\"namespaces\":[{\"name\":[\"example\"]}],\"imports\":[],\"declarations\":[]}"

and decode Bond data types from JSON:

> decode "{\"namespaces\":[{\"name\":[\"example\"]}],\"imports\":[],\"declarations\":[]}" :: Maybe Bond
Just (Bond {bondImports = [], bondNamespaces = [Namespace {nsLanguage = Nothing, nsName = ["example"]}], bondDeclarations = []})