0
$             "properties": [
                {
                   "name": "Armour",
                   "values": [
                      [
                         "258",
                         1
                      ]
                   ],
                   "displayMode": 0
                },...]

I have this JSON array.

I use json4s and scala for parse this code.

case class Property(
    name: String,
    values: Option[Option[(String, Int)]] = None,
    displayMode: Int
)

I write case class for this block, but I get "None" when get values...

I need get "258" in this example. What am I doing wrong?

J0e3gan
  • 8,740
  • 10
  • 53
  • 80

2 Answers2

0

Your Json looks like you have a list of lists under your values property. I guess you want to have something like dictionary which should be with curly brackets instead of just brackets. Other thing is why would you parse that into Option[Option[(String, Int)]]? Try defining that as optional Map[String, Int].

Matija Gobec
  • 850
  • 6
  • 12
  • Yes, but I get a JSON just brackets instead of curly brackets. And I just do not understand how to handle it. It is not a list of lists. I use Option because without it breaks down the entire Property, and with it - only values – Anatoliy Evladov May 22 '16 at 20:38
0

Could this work?

values: List[(String, Int)] = Nil
Ashalynd
  • 12,363
  • 2
  • 34
  • 37