{"action":"created","comment":{"url":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/comments/71845762","id":71845762,"diff_hunk":"@@ -0,0 +1,145 @@\n+package circelib\n+\n+import io.circe.Json\n+import org.scalaexercises.definitions\n+import org.scalatest._\n+import circelib.helpers.JsonHelpers\n+\n+/** @param name Json\n+  */\n+object JsonSection extends FlatSpec with Matchers with definitions.Section {\n+\n+  import JsonHelpers._\n+\n+  /** Json is the circe data type to represent a Json object. It is a very useful data type to be familiar with since\n+    * it's how circe is modeling the base type we want to deal with.\n+    *\n+    * Firstly, let's talk briefly about the shape of everyt Json object. It basically is semi structured data build on\n+    * top of key-value pairs. These key-value pairs have a specific shape:\n+    *   - keys are strings\n+    *   - values can be of multiple types.\n+    *\n+    * Then, to model a real json object we need to support different data types on the value field. For this purposes\n+    * we have different available methods so we can create a Json object from different source data types. Some examples\n+    * of these methods are `fromString`, `fromBoolean`, `fromDouble` and so on. For further details about all possible\n+    * methods, see https://travisbrown.github.io/circe/api/#io.circe.Json$\n+    *\n+    * Let's see how these methods work.\n+    *\n+    * {{{\n+    *   scala> // fromString example\n+    *   scala> val jsonString: Json = Json.fromString(\"scala exercises\")\n+    *   jsonString: io.circe.Json = \"scala exercises\"\n+    *\n+    *   scala> // fromDouble example\n+    *   scala> val jsonDouble: Option[Json] = Json.fromDouble(1)\n+    *   jsonDouble: Option[io.circe.Json] = Some(1.0)\n+    *\n+    *   scala> val jsonDouble: Option[Json] = Json.fromDouble(1)\n+    *   jsonString: Option[io.circe.Json] = Some(1.0)\n+    *\n+    *   scala> // fromFields example\n+    *   scala> val fieldList = List(\n+    *           (\"key1\", Json.fromString(\"value1\")),\n+    *           (\"key2\", Json.fromInt(1)))\n+    *   fieldList: List[(String, io.circe.Json)] = List((key1,\"value1\"), (key2,1))\n+    *\n+    *   scala> val jsonFromFields: Json = Json.fromFields(fieldList)\n+    *   jsonFromFields: io.circe.Json =\n+    *   {\n+    *     \"key1\" : \"value1\",\n+    *     \"key2\" : 1\n+    *   }\n+    *\n+    * }}}\n+    *\n+    *\n+    * In addition, there are some other methods that allow you to convert from a Json object to a String.\n+    *\n+    * {{{\n+    *\n+    *   scala> jsonFromFields.noSpaces\n+    *   res0: String = {\"name\":\"sample json\",\"version\":1,\"data\":{\"done\":false,\"rate\":4.9}}\n+    *\n+    *   scala> jsonFromFields.spaces2\n+    *   res1: String =\n+    *   {\n+    *     \"name\" : \"sample json\",\n+    *     \"version\" : 1,\n+    *     \"data\" : {\n+    *       \"done\" : false,\n+    *       \"rate\" : 4.9\n+    *     }\n+    *   }\n+    *\n+    *   scala> jsonFromFields.spaces4\n+    *   res2: String =\n+    *   {\n+    *       \"name\" : \"sample json\",\n+    *       \"version\" : 1,\n+    *       \"data\" : {\n+    *           \"done\" : false,\n+    *           \"rate\" : 4.9\n+    *       }\n+    *   }\n+    *\n+    * }}}\n+    *\n+    * What would be the string output for our jsonFromFields value?\n+    */\n+  def jsonToString(res0: String) = {\n+\n+    jsonFromFields.noSpaces should be (res0)\n+  }\n+\n+   /** Let's see how we can use these methods to create custom Jsons that represents specific Json strings.\n+    */\n+  def jsonObject(res0: Json, res1: (String, Json), res2: (String, Json), res3: Json) = {\n+\n+    \"{\\\"key\\\":\\\"value\\\"}\" should be(res0.noSpaces)","path":"src/main/scala/circelib/JsonSection.scala","position":99,"original_position":99,"commit_id":"b3194aeabd19c60eab894331bb37ff95c106e71c","original_commit_id":"1fa537bcd6dcd799a7548a639aec64f66ae6fcad","user":{"login":"noelmarkham","id":1492487,"avatar_url":"https://avatars.githubusercontent.com/u/1492487?v=3","gravatar_id":"","url":"https://api.github.com/users/noelmarkham","html_url":"https://github.com/noelmarkham","followers_url":"https://api.github.com/users/noelmarkham/followers","following_url":"https://api.github.com/users/noelmarkham/following{/other_user}","gists_url":"https://api.github.com/users/noelmarkham/gists{/gist_id}","starred_url":"https://api.github.com/users/noelmarkham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noelmarkham/subscriptions","organizations_url":"https://api.github.com/users/noelmarkham/orgs","repos_url":"https://api.github.com/users/noelmarkham/repos","events_url":"https://api.github.com/users/noelmarkham/events{/privacy}","received_events_url":"https://api.github.com/users/noelmarkham/received_events","type":"User","site_admin":false},"body":"👍 ","created_at":"2016-07-22T08:43:02Z","updated_at":"2016-07-22T08:43:02Z","html_url":"https://github.com/scala-exercises/exercises-circe/pull/2#discussion_r71845762","pull_request_url":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/comments/71845762"},"html":{"href":"https://github.com/scala-exercises/exercises-circe/pull/2#discussion_r71845762"},"pull_request":{"href":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/2","id":78320287,"html_url":"https://github.com/scala-exercises/exercises-circe/pull/2","diff_url":"https://github.com/scala-exercises/exercises-circe/pull/2.diff","patch_url":"https://github.com/scala-exercises/exercises-circe/pull/2.patch","issue_url":"https://api.github.com/repos/scala-exercises/exercises-circe/issues/2","number":2,"state":"open","locked":false,"title":"Adds Json section","user":{"login":"FPerezP","id":479485,"avatar_url":"https://avatars.githubusercontent.com/u/479485?v=3","gravatar_id":"","url":"https://api.github.com/users/FPerezP","html_url":"https://github.com/FPerezP","followers_url":"https://api.github.com/users/FPerezP/followers","following_url":"https://api.github.com/users/FPerezP/following{/other_user}","gists_url":"https://api.github.com/users/FPerezP/gists{/gist_id}","starred_url":"https://api.github.com/users/FPerezP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FPerezP/subscriptions","organizations_url":"https://api.github.com/users/FPerezP/orgs","repos_url":"https://api.github.com/users/FPerezP/repos","events_url":"https://api.github.com/users/FPerezP/events{/privacy}","received_events_url":"https://api.github.com/users/FPerezP/received_events","type":"User","site_admin":false},"body":"We are adding the first of 6 sections for Circe.\r\n\r\nSections will be:\r\n\r\n1. - Json\r\n2. - Parse\r\n3. - Decoder\r\n4. - Encoder\r\n5. - Cursor\r\n6. - HCursor\r\n7. - ACursor\r\n\r\n@raulraja @dialelo @noelmarkham @franciscodr could you please take a look? Thanks!\r\n\r\n@MaureenElsberry could you please review _src/main/scala/circelib/JsonSection.scala_? It contains all the explanaitons about these exercises. Thanks a lot.\r\n","created_at":"2016-07-21T13:57:33Z","updated_at":"2016-07-22T08:43:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c3e5b92735eb6eced10316d49d7a7df827d15b5e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/2/commits","review_comments_url":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/2/comments","review_comment_url":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala-exercises/exercises-circe/issues/2/comments","statuses_url":"https://api.github.com/repos/scala-exercises/exercises-circe/statuses/b3194aeabd19c60eab894331bb37ff95c106e71c","head":{"label":"scala-exercises:fp-init-circe","ref":"fp-init-circe","sha":"b3194aeabd19c60eab894331bb37ff95c106e71c","user":{"login":"scala-exercises","id":17570897,"avatar_url":"https://avatars.githubusercontent.com/u/17570897?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-exercises","html_url":"https://github.com/scala-exercises","followers_url":"https://api.github.com/users/scala-exercises/followers","following_url":"https://api.github.com/users/scala-exercises/following{/other_user}","gists_url":"https://api.github.com/users/scala-exercises/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-exercises/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-exercises/subscriptions","organizations_url":"https://api.github.com/users/scala-exercises/orgs","repos_url":"https://api.github.com/users/scala-exercises/repos","events_url":"https://api.github.com/users/scala-exercises/events{/privacy}","received_events_url":"https://api.github.com/users/scala-exercises/received_events","type":"Organization","site_admin":false},"repo":{"id":62388761,"name":"exercises-circe","full_name":"scala-exercises/exercises-circe","owner":{"login":"scala-exercises","id":17570897,"avatar_url":"https://avatars.githubusercontent.com/u/17570897?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-exercises","html_url":"https://github.com/scala-exercises","followers_url":"https://api.github.com/users/scala-exercises/followers","following_url":"https://api.github.com/users/scala-exercises/following{/other_user}","gists_url":"https://api.github.com/users/scala-exercises/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-exercises/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-exercises/subscriptions","organizations_url":"https://api.github.com/users/scala-exercises/orgs","repos_url":"https://api.github.com/users/scala-exercises/repos","events_url":"https://api.github.com/users/scala-exercises/events{/privacy}","received_events_url":"https://api.github.com/users/scala-exercises/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scala-exercises/exercises-circe","description":null,"fork":false,"url":"https://api.github.com/repos/scala-exercises/exercises-circe","forks_url":"https://api.github.com/repos/scala-exercises/exercises-circe/forks","keys_url":"https://api.github.com/repos/scala-exercises/exercises-circe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scala-exercises/exercises-circe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scala-exercises/exercises-circe/teams","hooks_url":"https://api.github.com/repos/scala-exercises/exercises-circe/hooks","issue_events_url":"https://api.github.com/repos/scala-exercises/exercises-circe/issues/events{/number}","events_url":"https://api.github.com/repos/scala-exercises/exercises-circe/events","assignees_url":"https://api.github.com/repos/scala-exercises/exercises-circe/assignees{/user}","branches_url":"https://api.github.com/repos/scala-exercises/exercises-circe/branches{/branch}","tags_url":"https://api.github.com/repos/scala-exercises/exercises-circe/tags","blobs_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/refs{/sha}","trees_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scala-exercises/exercises-circe/statuses/{sha}","languages_url":"https://api.github.com/repos/scala-exercises/exercises-circe/languages","stargazers_url":"https://api.github.com/repos/scala-exercises/exercises-circe/stargazers","contributors_url":"https://api.github.com/repos/scala-exercises/exercises-circe/contributors","subscribers_url":"https://api.github.com/repos/scala-exercises/exercises-circe/subscribers","subscription_url":"https://api.github.com/repos/scala-exercises/exercises-circe/subscription","commits_url":"https://api.github.com/repos/scala-exercises/exercises-circe/commits{/sha}","git_commits_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/commits{/sha}","comments_url":"https://api.github.com/repos/scala-exercises/exercises-circe/comments{/number}","issue_comment_url":"https://api.github.com/repos/scala-exercises/exercises-circe/issues/comments{/number}","contents_url":"https://api.github.com/repos/scala-exercises/exercises-circe/contents/{+path}","compare_url":"https://api.github.com/repos/scala-exercises/exercises-circe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scala-exercises/exercises-circe/merges","archive_url":"https://api.github.com/repos/scala-exercises/exercises-circe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scala-exercises/exercises-circe/downloads","issues_url":"https://api.github.com/repos/scala-exercises/exercises-circe/issues{/number}","pulls_url":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls{/number}","milestones_url":"https://api.github.com/repos/scala-exercises/exercises-circe/milestones{/number}","notifications_url":"https://api.github.com/repos/scala-exercises/exercises-circe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scala-exercises/exercises-circe/labels{/name}","releases_url":"https://api.github.com/repos/scala-exercises/exercises-circe/releases{/id}","deployments_url":"https://api.github.com/repos/scala-exercises/exercises-circe/deployments","created_at":"2016-07-01T11:36:13Z","updated_at":"2016-07-01T11:36:13Z","pushed_at":"2016-07-21T16:52:55Z","git_url":"git://github.com/scala-exercises/exercises-circe.git","ssh_url":"git@github.com:scala-exercises/exercises-circe.git","clone_url":"https://github.com/scala-exercises/exercises-circe.git","svn_url":"https://github.com/scala-exercises/exercises-circe","homepage":null,"size":12,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"scala-exercises:master","ref":"master","sha":"b762749e79dae3f04484b54bc4a7ced7851c093b","user":{"login":"scala-exercises","id":17570897,"avatar_url":"https://avatars.githubusercontent.com/u/17570897?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-exercises","html_url":"https://github.com/scala-exercises","followers_url":"https://api.github.com/users/scala-exercises/followers","following_url":"https://api.github.com/users/scala-exercises/following{/other_user}","gists_url":"https://api.github.com/users/scala-exercises/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-exercises/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-exercises/subscriptions","organizations_url":"https://api.github.com/users/scala-exercises/orgs","repos_url":"https://api.github.com/users/scala-exercises/repos","events_url":"https://api.github.com/users/scala-exercises/events{/privacy}","received_events_url":"https://api.github.com/users/scala-exercises/received_events","type":"Organization","site_admin":false},"repo":{"id":62388761,"name":"exercises-circe","full_name":"scala-exercises/exercises-circe","owner":{"login":"scala-exercises","id":17570897,"avatar_url":"https://avatars.githubusercontent.com/u/17570897?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-exercises","html_url":"https://github.com/scala-exercises","followers_url":"https://api.github.com/users/scala-exercises/followers","following_url":"https://api.github.com/users/scala-exercises/following{/other_user}","gists_url":"https://api.github.com/users/scala-exercises/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-exercises/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-exercises/subscriptions","organizations_url":"https://api.github.com/users/scala-exercises/orgs","repos_url":"https://api.github.com/users/scala-exercises/repos","events_url":"https://api.github.com/users/scala-exercises/events{/privacy}","received_events_url":"https://api.github.com/users/scala-exercises/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scala-exercises/exercises-circe","description":null,"fork":false,"url":"https://api.github.com/repos/scala-exercises/exercises-circe","forks_url":"https://api.github.com/repos/scala-exercises/exercises-circe/forks","keys_url":"https://api.github.com/repos/scala-exercises/exercises-circe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scala-exercises/exercises-circe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scala-exercises/exercises-circe/teams","hooks_url":"https://api.github.com/repos/scala-exercises/exercises-circe/hooks","issue_events_url":"https://api.github.com/repos/scala-exercises/exercises-circe/issues/events{/number}","events_url":"https://api.github.com/repos/scala-exercises/exercises-circe/events","assignees_url":"https://api.github.com/repos/scala-exercises/exercises-circe/assignees{/user}","branches_url":"https://api.github.com/repos/scala-exercises/exercises-circe/branches{/branch}","tags_url":"https://api.github.com/repos/scala-exercises/exercises-circe/tags","blobs_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/refs{/sha}","trees_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scala-exercises/exercises-circe/statuses/{sha}","languages_url":"https://api.github.com/repos/scala-exercises/exercises-circe/languages","stargazers_url":"https://api.github.com/repos/scala-exercises/exercises-circe/stargazers","contributors_url":"https://api.github.com/repos/scala-exercises/exercises-circe/contributors","subscribers_url":"https://api.github.com/repos/scala-exercises/exercises-circe/subscribers","subscription_url":"https://api.github.com/repos/scala-exercises/exercises-circe/subscription","commits_url":"https://api.github.com/repos/scala-exercises/exercises-circe/commits{/sha}","git_commits_url":"https://api.github.com/repos/scala-exercises/exercises-circe/git/commits{/sha}","comments_url":"https://api.github.com/repos/scala-exercises/exercises-circe/comments{/number}","issue_comment_url":"https://api.github.com/repos/scala-exercises/exercises-circe/issues/comments{/number}","contents_url":"https://api.github.com/repos/scala-exercises/exercises-circe/contents/{+path}","compare_url":"https://api.github.com/repos/scala-exercises/exercises-circe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scala-exercises/exercises-circe/merges","archive_url":"https://api.github.com/repos/scala-exercises/exercises-circe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scala-exercises/exercises-circe/downloads","issues_url":"https://api.github.com/repos/scala-exercises/exercises-circe/issues{/number}","pulls_url":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls{/number}","milestones_url":"https://api.github.com/repos/scala-exercises/exercises-circe/milestones{/number}","notifications_url":"https://api.github.com/repos/scala-exercises/exercises-circe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scala-exercises/exercises-circe/labels{/name}","releases_url":"https://api.github.com/repos/scala-exercises/exercises-circe/releases{/id}","deployments_url":"https://api.github.com/repos/scala-exercises/exercises-circe/deployments","created_at":"2016-07-01T11:36:13Z","updated_at":"2016-07-01T11:36:13Z","pushed_at":"2016-07-21T16:52:55Z","git_url":"git://github.com/scala-exercises/exercises-circe.git","ssh_url":"git@github.com:scala-exercises/exercises-circe.git","clone_url":"https://github.com/scala-exercises/exercises-circe.git","svn_url":"https://github.com/scala-exercises/exercises-circe","homepage":null,"size":12,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/2"},"html":{"href":"https://github.com/scala-exercises/exercises-circe/pull/2"},"issue":{"href":"https://api.github.com/repos/scala-exercises/exercises-circe/issues/2"},"comments":{"href":"https://api.github.com/repos/scala-exercises/exercises-circe/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala-exercises/exercises-circe/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/scala-exercises/exercises-circe/statuses/b3194aeabd19c60eab894331bb37ff95c106e71c"}}}}
{"actor":{"display_login":"noelmarkham"}}