JSON typeclasses that know the difference between null and absent fields
obj and arr build JSON structures
note: The above example uses magnets to produce an object building syntax similar to how you’d build a
scala.collection.Map. This is intuitive, but can produce unhelpful compiler errors. Instead, you can use a “long arrow”-->or “squiggly arrow”~>to get better compiler errors for debugging, or just because you don’t like magnets. See below for an example
With immutable ASTs it can be a pain to update values deep inside the tree.
You can use ninny’s dynamic update syntax easly to replace values way down in there.
ToJson and FromJsonRather than implementing ToJson and FromJson by hand, you can generate them
automatically using
See more on configuring automatic derivation here.
forProductN derivation for ToJson and FromJsonOften you want to have different names in a case class than what’s in the JSON, but you don’t need to change the types at all. forProductN methods are perfect for this, just specify what the JSON field name should be and provide the case class apply/unapply method to generate a ToJson, FromJson, or both together.