Skip to content
A simple Purescript JSON library that uses types automatically
PureScript Makefile Erlang JavaScript
Branch: master
Clone or download
Pull request Compare This branch is 3 commits ahead, 32 commits behind justinwoo:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status Documentation Status

A simple Foreign/JSON library based on the Purescript's RowToList feature.

Get going quickly with the Quickstart section of the guide:

You may also be interested in this presentation about how Simple-JSON works well with PureScript-Record: Note that the slides are based on an older version of the library and on PureScript 0.11.6, and it is not necessary to understand these slides to get started.


In brief:

type MyJSON =
  { apple :: String
  , banana :: Int
  , cherry :: Maybe Boolean
decodeToMyJSON :: String -> Either (NonEmptyList ForeignError) MyJSON
decodeToMyJSON = SimpleJSON.readJSON

See the API Docs or the tests for usage.

There is also a guide for how to use this library on Read the Docs.

Warning: Maybe

This library will decode undefined and null as Nothing and write Nothing as undefined. Please use the Nullable type if you'd like to read and write null instead. Please take caution when using Maybe as this default may not be what you want.

You can’t perform that action at this time.