Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
to do : manage maps
json 2 case class
=================

Kickstart your scala API client by turning JSON into case classes.

Try it at <http://json2caseclass.cleverapps.io>

##Use cases

When interacting with 3rd party json-based APIs from scala, modelling the API's responses with case classes
can come in handy.
If the JSON exhibits some properties (homogenous lists, for instance), it's easy to create a case class with
the same structure. With some deserialization magic it's easier to deal with the API's responses.

case class Foo(a: Bar, b: Bar, c: Double)
case class Bar(a: Option[String], b: String)

{
"a": {
"a": "fubar",
"b": "fubar"
},
"b": {
"b": "baz"
},
"c": 42.0
}

However it's tedious to manually copy the json structure into case classes.

json 2 case class automatically generates case classes from JSON (if possible).

##Features

json 2 case class can generate

- nested case classes from JSON objects
- lists from JSON arrays
- scala base types from JSON primitives
- Option[T] for optional values

##ToDo

Due to the arity limitation of 22 values, some JSON objects can't be encoded with case classes.
A Map[String,T] fallback is on the works.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h1>json 2 case class</h1>
<p>The basic idea to start the developement is to allow fast API integration, and forget boring time of case class mapping when using it for serialization/deserialization propose.</p>
<p id="about">This soft i on the GPLv3 licence and was created by the <a href="http://www.clever-cloud.com">Clever Cloud</a> team (awesome PaaS service allowing scala running fast) for internal needs.</p>

<button type="button" id="test_button" class="btn btn-primary"><i class="icon-legal"></i> Test it with some twitter datas</button>
<button type="button" id="test_button" class="btn btn-primary"><i class="icon-legal"></i> Test it with some twitter data</button>
</div>
<div class="span3">
<h3><i class="icon-share"></i> Share the good news</h3>
Expand Down