0

I have trouble to convert scala struct to json. I use library json4s.

val asanaList = Seq(("007", 536), ("008", 888))
println(compact(render(asanaList)))

The result is:

[{"007":536},{"008":888}]

I need something like:

[["007",536],["008",888]]

This example don't work either:

val asanaList = Seq(Seq("007", 536), Seq("008", 888))
Sol
  • 320
  • 2
  • 8
  • Have you tried `Seq(Seq("007", "536"), Seq("008", "888"))` OR `Seq(Seq(007, 536), Seq(008, 888))`? Any special reasons you want two different types in your sequence ? – Soumya Simanta May 28 '15 at 11:56
  • My original json was `[{"id":"007", "duration":536}, ...]`. I just wanted to shorten it. `Seq(Seq("007", "536"), Seq("008", "888"))` work like a charm. I think I must use it. – Sol May 28 '15 at 13:56

0 Answers0