Code Monkey home page Code Monkey logo

spray-json-shapeless's Introduction

spray-json-shapeless

Automatically derive spray-json JsonFormats, powered by shapeless (no macros were written during the creation of this library).

For documentation, read the scaladocs and for examples read the test cases.

Please read the documentation - especially the caveats - and examples before raising a ticket.

TL;DR

// always check maven central for the lastest release
libraryDependencies += "com.github.fommil" %% "spray-json-shapeless" % "1.2.0"
import spray.json._
import fommil.sjs.FamilyFormats._

object domain {
  sealed trait SimpleTrait
  case class Foo(s: String) extends SimpleTrait
  case class Bar() extends SimpleTrait
  case object Baz extends SimpleTrait
  case class Faz(o: Option[String]) extends SimpleTrait
}
object use {
  import domain._

  Foo("foo").toJson                // """{"s":"foo"}"""
  Faz(Some("meh")).toJson          // """{"o":"meh"}"""
  Faz(None).toJson                 // """{}"""
  (Foo("foo"): SimpleTrait).toJson // """{"type":"Foo","s":"foo"}"""
  (Bar(): SimpleTrait).toJson      // """{"type":"Bar"}"""
  (Baz: SimpleTrait).toJson        // """{"type":"Baz"}"""
  (Faz(None): SimpleTrait).toJson  // """{"type":"Faz"}"""
}

License

spray-json-shapeless is Free Software under the Apache License v2.

I would prefer a copyleft license because TypeSafe have set the precedent of closing sources and it is extremely concerning that this is happening within our community.

However, both of the primary upstream projects, spray-json and shapeless, are published under Apache v2, so it is more appropriate to publish this project on the same terms.

spray-json-shapeless's People

Contributors

acjay avatar aemoncannon avatar alexarchambault avatar djspiewak avatar fabianpage avatar fanatoly avatar fgeller avatar fommil avatar gitter-badger avatar gneuvill avatar jfager avatar jschlather avatar kopiczko avatar marcsaegesser avatar marcweber avatar markschaake avatar mdr avatar milessabin avatar pashky avatar peluko avatar rajish avatar rorygraves avatar sksamuel avatar snapcracklepopgone avatar stew avatar tbje avatar tototoshi avatar wohanley avatar wspringer avatar xeno-by avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.