narman12
narman12

Reputation: 43

circe-json and scala neted objects processing

I have to create a json in the below format using scala and circe-json encoder classes

 {
"actions":{
   "action1":{
      "read":[
         {
            "parq":[
               {
                  "str":""
               },
               {
                  "tab":""
               }
            ]
         }
      ],
      "transform":[
         {
            "transform":[
               {
                  "col":""
               },
               {
                  "col_def":""
               }
            ]
         }
      ],
      "write":[
         {
            "parq":[
               {
                  "path":""
               }
            ]
         }
      ]
   }
}
}

how to use scala circe-json encoder to process this object?

I have issue while read nested array objects

   object test_oo extends App {

  case class rtab(tableName:String)
  case class rpath(path:String)
  case class Rparquet(parquet:List[Map[String,String]])


  val p = Rparquet(List(rpath("hdfs"),rtab("test_table"))).asJson
  print(p)
}

Error below

List [Product with serializable] not enough arguments for method asJson: (implicit encoder: io.circe.Encoder[yaml.test_oo.Rparquet])io.circe.Json. Unspecified value parameter encoder. val p = Rparquet(List(rpath("hdfs"),rtab("test_table"))).asJson

Im not able read read_path and tab_name in same case class read_parquet and try encoding could any one help me on it

Upvotes: 1

Views: 106

Answers (0)

Related Questions